Manage the Cloudflare Stream API with ease.
MIT License
Manage Cloudflare Stream with ease by using this handy PHP API wrapper. The laravel-cloudflare-stream
package gives ability to...
Feel free to check out the Cloudflare Stream documentation and API documentation for further information.
Add the following to your root composer.json
and install with composer install
or composer update
.
{
"require": {
"afloeter/laravel-cloudflare-stream": "~1.0.0"
}
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/afloeter/laravel-cloudflare-stream"
}
]
...or use composer require afloeter/laravel-cloudflare-stream
in your console after just adding the repository to your composer.json file.
Publish the config file with php artisan vendor:publish --provider="AFloeter\CloudflareStreamServiceProvider"
.
.env
fileAdd the following lines to your root .env
file of your Laravel instance.
CLOUDFLARE_STREAM_ACCOUNT_ID=
CLOUDFLARE_STREAM_AUTH_KEY=
CLOUDFLARE_STREAM_AUTH_EMAIL=
CLOUDFLARE_STREAM_PRIVATE_KEY_ID=
CLOUDFLARE_STREAM_PRIVATE_KEY_TOKEN=
Complete the following information.
CLOUDFLARE_STREAM_ACCOUNT_ID
is your Cloudflare account ID.CLOUDFLARE_STREAM_AUTH_KEY
is your Cloudflare API key.CLOUDFLARE_STREAM_AUTH_EMAIL
is the email address of your Cloudflare account.Leave CLOUDFLARE_STREAM_PRIVATE_KEY_ID
and CLOUDFLARE_STREAM_PRIVATE_KEY_TOKEN
blank if you don't use signed URLs at all.
CLOUDFLARE_STREAM_PRIVATE_KEY_ID
is the ID of your signing keyCLOUDFLARE_STREAM_PRIVATE_KEY_TOKEN
is the related RSA private key.Otherwise: Check the documentation on how to create a signing key and get RSA private key in PEM format.
If you have done the vendor:publish
step, your credentials will be grabbed from the config/cloudflare-stream.php
and / or .env
file. So, you can use CloudflareStreamLaravel()
without providing your information once again.
use AFloeter\CloudflareStream\CloudflareStreamLaravel;
...
$cfs = new CloudflareStreamLaravel();
$listOfVideos = $cfs->list();
...
If you are on composer-enabled projects use CloudflareStream()
. Without composer try requiring src/CloudflareStream.php
directly into your project.
use AFloeter\CloudflareStream\CloudflareStream;
...
$cfs = new CloudflareStream($accountId, $authKey, $authEMail);
$listOfVideos = $cfs->list();
...
If you are using signed URLs for your videos, simply add the $privateKey
and $privateKeyToken
variables.
use AFloeter\CloudflareStream\CloudflareStream;
...
$cfs = new CloudflareStream($accountId, $authKey, $authEMail, $privateKey, $privateKeyToken);
$signedToken = $cfs->getSignedToken($videoId);
...
It's planned to add support to...
ankitpokhrel/tus-php
.vtt
caption files.All notable changes to laravel-cloudflare-stream
will be documented here.
laravel-cloudflare-stream
is distributed under the terms of the MIT License.