silinternational / zoom-php-client
用于与 Zoom API 交互的 PHP 客户端库
Requires
- php: >=7.2.0
- guzzlehttp/guzzle-services: *
Requires (Dev)
- ext-json: *
- phpunit/phpunit: ~4.0
- roave/security-advisories: dev-master
This package is auto-updated.
Last update: 2021-01-23 17:14:51 UTC
README
zoom-php-client
用于与 Zoom API 交互的 PHP 客户端。
随着功能的需要,我们正在逐渐构建这个客户端。
此客户端基于 Guzzle 构建,Guzzle 是一个 PHP HTTP 客户端。Guzzle 提供了一种简单的方法来创建 API 客户端,通过使用类似于 Swagger 的格式来描述 API,无需自行实现每个方法。因此,添加对更多 Zoom API 的支持相对简单。如果您想提交一个拉取请求以添加其他功能,请这样做。如果您不知道如何做,请询问我们,我们可能能够为您添加它。
Zoom API 文档
https://support.zoom.us/hc/en-us/sections/200305463-API
Zoom API 认证
Zoom 使用 API 密钥和密钥。有关详细信息,请参阅 使用 REST API 入门 - Zoom 支持中心。
安装
使用 Composer 安装简单。
$ composer require silinternational/zoom-php-client
使用方法
示例
<?php use Zoom\UserClient; $userClient = new UserClient([ 'api_key' => 'abc', 'api_secret' => '123', ]); $user = $userClient->getByEmail([ 'email' => 'test@abc.com', 'login_type' => 100, ]);
侧注:有关可能的 login_type
值列表,请参阅 Zoom 的 API 文档(在上面的链接中)。
警告:Zoom API SSL 问题
在我使用 Git Bash 控制台(Git 2.5)测试 Windows 7 PC 时,返回以下错误
GuzzleHttp\Command\Exception\CommandException: Error executing command: cURL error 60: See http://curl.haxx.se/libcurl/c/libcurl-errors.html
这似乎意味着我在电脑上使用的 SSL CA 包不包含 Zoom API 所使用的根 CA。要传递与 Guzzle 相关的参数,您可以执行以下操作
$userClient = $this->getUserClient([
// ...
'http_client_options' => [
'defaults' => [
'verify' => __DIR__ . '/../../ca-bundle.crt',
],
],
]);
在这个例子中,我将 verify
指向了 Mozilla 提供的 CA 包 的下载副本,如 Guzzle 文档中关于 verify 选项 中提到的。
测试
要为此运行单元测试,请将 /tests/real-test-data.local.php.dist
文件复制到 /tests/real-test-data.local.php
并输入真实数据进行测试。
Guzzle 服务客户端说明
- 关于使用 Guzzle Web Services 开发 API 客户端的教程
http://www.phillipshipley.com/2015/04/creating-a-php-nexmo-api-client-using-guzzle-web-service-client-part-1/ - Jeremy Lindblom 的演讲
https://speakerdeck.com/jeremeamia/building-web-service-clients-with-guzzle-1 - Jeremy Lindblom 的示例
https://github.com/jeremeamia/sunshinephp-guzzle-examples - 源代码注释中的参数文档
https://github.com/guzzle/guzzle-services/blob/master/src/Parameter.php - Guzzle 3 服务描述文档(至少大部分仍然相关)
https://guzzle3.readthedocs.org/webservice-client/guzzle-service-descriptions.html