espresso-dev/zoom-php

用于访问Zoom API的简单PHP类

v1.0.1 2020-12-07 06:01 UTC

This package is auto-updated.

Last update: 2024-09-07 14:31:47 UTC


README

Zoom API的简单PHP包装器

Latest Stable Version License Total Downloads

有可用的Composer包。

需求

  • PHP 7或更高版本
  • cURL
  • Zoom开发者账户
  • Zoom应用

开始使用

要使用Zoom API,您需要注册一个Zoom应用。遵循创建OAuth应用指南

安装

强烈建议使用Composer以保持更新尽可能平滑。

$ composer require espresso-dev/zoom-php

初始化类

use EspressoDev\Zoom\Zoom;

$zoom = new Zoom([
    'appId' => 'YOUR_APP_ID',
    'appSecret' => 'YOUR_APP_SECRET',
    'redirectUri' => 'YOUR_APP_REDIRECT_URI'
]);

echo "<a href='{$zoom->getLoginUrl()}'>Login with Zoom</a>";

用户认证(OAuth2)

// Get the OAuth callback code
$code = $_GET['code'];

// Get the access token (valid for 1 hour) and refresh token
$token = $zoom->getOAuthToken($code);

echo 'Your token is: ' . $token->access_token;
echo 'Your refresh token is: ' . $token->refresh_token;

获取用户计划会议

// Set user access token
$zoom->setAccessToken($token);

// Get the users scheduled meetins
$meetings = $zoom->getUserMeetings('me', 'scheduled');

echo '<pre>';
print_r($meetings);
echo '<pre>';

所有方法都以json_decode()返回API数据 - 因此您可以直接访问数据。

可用方法

设置Zoom

new Zoom(<数组>/<字符串>);

数组如果您想执行OAuth

new Zoom([
    'appId' => 'YOUR_APP_ID',
    'appSecret' => 'YOUR_APP_SECRET',
    'redirectUri' => 'YOUR_APP_REDIRECT_URI'
]);

字符串一旦您有了令牌,只想返回只读数据

new Zoom('ACCESS_TOKEN');

获取登录URL

getLoginUrl(<字符串>)

getLoginUrl(
    'state'
);

获取OAuth令牌(短期有效1小时)

getOAuthToken($code)

刷新访问令牌,再有效1小时,并获取更新的刷新令牌

refreshToken($refreshToken)

设置/获取访问令牌

  • 设置访问令牌,以便进行后续方法调用:setAccessToken($token)
  • 获取访问令牌,如果您想将其存储以供以后使用:getAccessToken()

用户方法

有关每个方法的更多信息,请参阅Zoom API文档

认证方法

  • getUserMeetings(<$id>, <$type>, <$page_size>, <$page_number>)
  • getUserMeetings(<$id>, <$page_size>, <$page_number>)