PHP code example of bjthecod3r / laravel-cloudflare-stream

1. Go to this page and download the library: Download bjthecod3r/laravel-cloudflare-stream library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bjthecod3r / laravel-cloudflare-stream example snippets


CLOUDFLARE_API_TOKEN=xxxxxxxxxxxx
CLOUDFLARE_ACCOUNT_ID=xxxxxxxxxxxxxxxxx
CLOUDFLARE_BASE_API_URL=https://api.cloudflare.com/client/v4/accounts
CLOUDFLARE_KEY_ID=xxxxxxxxxxxxxxx

use Bjthecod3r\CloudflareStream\CloudflareStream;

use Bjthecod3r\CloudflareStream\Facades\CloudflareStream as CloudflareStreamFacade;

class StreamService
{
    public function fetchStream(string $id, CloudflareStream $cloudflareStream)
    {
        dd($cloudflareStream->fetchVideo($id));
    }
    
    public function fetchVideo(string $id): array
    {
       return CloudflareStreamFacade::fetchVideo(string $id)
    }
}
bash
php artisan vendor:publish --provider="Bjthecod3r\CloudflareStream\CloudflareStreamServiceProvider"