boldbrush / cloudflare-streams-php
Cloudfare SDK for Streams API
0.2.0
2020-11-05 20:39 UTC
Requires
- php: >=5.6
- ext-curl: *
This package is auto-updated.
Last update: 2024-09-06 04:57:19 UTC
README
安装
$ composer require boldbrush/cloudflare-streams-php
使用
require '../vendor/autoload.php'; use BoldBrush\Cloudflare\API; /** @var API\Enpoints\Streams */ $api = API\Factory::make( '<account>', '<apiKey>', '<email>' );
- account: 设置您的账户ID(可以在您的仪表板URL或DNS区域中找到)
- apiKey: 使用您的全局API密钥,以及您的电子邮件地址,或使用 'api_token' 作为电子邮件,并使用配置的API令牌。
- email: 设置您的登录电子邮件,并结合您的全局API密钥,或将 'api_token' 与配置的API令牌结合。
获取流列表
/** @var API\Response\Stream[] */ $streams = $api->getStreams();
获取流的详细信息
/** @var API\Response\Stream */ $stream = $api->getStream('<uid>');
从URL上传流
/** @var API\Response\Stream */ $stream = $api->copy('<url>');
删除流
/** @var bool */ $success = $api->delete('<uid>');
获取流的嵌入代码片段
/** @var string */ $html = $api->getEmbedSnippet('<uid>')