szhorvath / laravel-cloudflare-stream
This is my package laravel-cloudflare-stream
Fund package maintenance!
szhorvath
Requires
- php: ^8.1 || ^8.2
- illuminate/contracts: ^10.0 || ^11.0
- php-http/mock-client: ^1.6
- spatie/laravel-package-tools: ^1.16
- spatie/laravel-webhook-client: ^3.4
Requires (Dev)
- larastan/larastan: ^2.9.8
- laravel/pint: ^1.17.3
- nunomaduro/collision: ^7.10 || ^8.4
- orchestra/testbench: ^8.26 || ^9.4
- pestphp/pest: ^2.35 || ^3.0
- pestphp/pest-plugin-arch: ^2.7 || ^3.0
- pestphp/pest-plugin-laravel: ^2.4 || 3.0
- phpstan/extension-installer: ^1.4.3
- phpstan/phpstan-deprecation-rules: ^1.2.1
- phpstan/phpstan-phpunit: ^1.4.0
- spatie/laravel-ray: ^1.37.1
- szhorvath/cloudflare-stream-php-sdk: dev-main
This package is auto-updated.
Last update: 2024-10-18 10:32:27 UTC
README
This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
Support us
We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.
Installation
You can install the package via composer:
composer require szhorvath/laravel-cloudflare-stream
You can publish and run the migrations with:
php artisan vendor:publish --tag="cloudflare-stream-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="cloudflare-stream-config"
This is the contents of the published config file:
return [ /* |-------------------------------------------------------------------------- | API Token |-------------------------------------------------------------------------- | | The API token used to authenticate with the Cloudflare Stream API. | @see https://dash.cloudflare.com/profile/api-tokens | */ 'api_token' => env('CLOUDFLARE_STREAM_API_TOKEN', ''), /* |-------------------------------------------------------------------------- | Account ID |-------------------------------------------------------------------------- | | The account ID used to authenticate with the Cloudflare Stream API. | */ 'account_id' => env('CLOUDFLARE_STREAM_ACCOUNT_ID', ''), /* |-------------------------------------------------------------------------- | Base URL |-------------------------------------------------------------------------- | | The base URL used with the Cloudflare Stream API. | */ 'base_url' => env('CLOUDFLARE_STREAM_BASE_URL', 'https://api.cloudflare.com/client/v4/'), /** |-------------------------------------------------------------------------- | Customer Subdomain |-------------------------------------------------------------------------- | | This domain is specific to your Cloudflare account. | Use it for all requests to fetch video manifests, thumbnails and embed codes. | */ 'customer_subdomain' => env('CLOUDFLARE_STREAM_CUSTOMER_SUBDOMAIN', 'customer-<customer_id>.cloudflarestream.com'), /* |-------------------------------------------------------------------------- | Signing Key ID |-------------------------------------------------------------------------- | This is the signing Key ID to generate tokens for signed URLs | @see https://developers.cloudflare.com/stream/viewing-videos/securing-your-stream/#option-2-generating-signed-tokens-without-calling-the-token-endpoint | */ 'key_id' => env('CLOUDFLARE_STREAM_KEY_ID', ''), /* |-------------------------------------------------------------------------- | Signing key PEM |-------------------------------------------------------------------------- | | This is the signing RSA private key in PEM format to generate tokens for signed URLs | @see https://developers.cloudflare.com/api/operations/stream-signing-keys-create-signing-keys | */ 'pem' => env('CLOUDFLARE_STREAM_KEY_PEM', ''), /* |-------------------------------------------------------------------------- | Default Options |-------------------------------------------------------------------------- | | This is the default options that will be applied to all upload | The `thumbnailTimestampPct` is a floating point value between 0.0 and 1.0. | All the commented defaults here don't seem to work for uploading via link | */ 'default_options' => [ 'requireSignedURLs' => true, //'allowedOrigins' => [], //'thumbnailTimestampPct' => 0.0 ], /* |-------------------------------------------------------------------------- | Webhook |-------------------------------------------------------------------------- | | Cloudflare stream webhook configuration. | This configuration will be merged with the Spatie Laravel Webhook Client - webhook-client configuration. | @see https://github.com/spatie/laravel-webhook-client | */ 'webhook' => [ /** * Enable or disable the Cloudflare Stream webhook client. */ 'enabled' => env('CLOUDFLARE_STREAM_WEBHOOK_ENABLED', true), /** * Spatie Laravel Webhook Client supports multiple webhook receiving endpoints. */ 'name' => 'cloudflare-stream', /** * The URL used to receive Cloudflare Stream webhooks. */ 'url' => 'webhooks/cloudflare-stream', /** * The middleware to be applied to the webhook route. */ 'middleware' => [], /** * The secret used to sign the webhook requests. * * @see https://developers.cloudflare.com/stream/manage-video-library/using-webhooks/#verify-webhook-authenticity */ 'signing_secret' => env('CLOUDFLARE_STREAM_WEBHOOK_SIGNING_SECRET', ''), /** * The name of the header containing the signature. */ 'signature_header_name' => env('CLOUDFLARE_STREAM_WEBHOOK_SIGNATURE_HEADER_NAME', 'Webhook-Signature'), /** * This class will verify that the content of the signature header is valid. * * It should implement \Spatie\WebhookClient\SignatureValidator\SignatureValidator */ 'signature_validator' => \Szhorvath\LaravelCloudflareStream\Webhook\StreamSignatureValidator::class, /** * This class determines if the webhook call should be stored and processed. */ 'webhook_profile' => \Spatie\WebhookClient\WebhookProfile\ProcessEverythingWebhookProfile::class, /** * This class determines the response on a valid webhook call. */ 'webhook_response' => \Spatie\WebhookClient\WebhookResponse\DefaultRespondsTo::class, /** * The classname of the model to be used to store webhook calls. The class should * be equal or extend Spatie\WebhookClient\Models\WebhookCall. */ 'webhook_model' => \Spatie\WebhookClient\Models\WebhookCall::class, /** * In this array, you can pass the headers that should be stored on * the webhook call model when a webhook comes in. * * To store all headers, set this value to `*`. */ 'store_headers' => '*', /** * The class name of the job that will process the webhook request. * * This should be set to a class that extends \Spatie\WebhookClient\Jobs\ProcessWebhookJob. */ 'process_webhook_job' => \Szhorvath\LaravelCloudflareStream\Jobs\ProcessCloudflareStreamJob::class, ], ];
Optionally, you can publish the views using
php artisan vendor:publish --tag="cloudflare-stream-views"
Usage
use Szhorvath\LaravelCloudflareStream\Facades\CloudflareStream; CloudflareStream::signer()->tokenFor('videoUid');
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.