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-11-06 05:19:40 UTC
README
Installation
$ composer require boldbrush/cloudflare-streams-php
Usage
require '../vendor/autoload.php'; use BoldBrush\Cloudflare\API; /** @var API\Enpoints\Streams */ $api = API\Factory::make( '<account>', '<apiKey>', '<email>' );
- account: set your account ID (can be found in your dashboard URL or when in a DNS zone)
- apiKey: use your Global API key, together with your email address, or use 'api_token' as the email and use a configured API Token.
- email: set your login email in combination with your Global API key, or set as 'api_token' combined with a configured API Token.
Get List of streams:
/** @var API\Response\Stream[] */ $streams = $api->getStreams();
Get details of a stream:
/** @var API\Response\Stream */ $stream = $api->getStream('<uid>');
Upload a stream from URL:
/** @var API\Response\Stream */ $stream = $api->copy('<url>');
Delete a stream:
/** @var bool */ $success = $api->delete('<uid>');
Get the embed snippet for a stream:
/** @var string */ $html = $api->getEmbedSnippet('<uid>')