PHP code example of tilson / laravel-youtube-client

1. Go to this page and download the library: Download tilson/laravel-youtube-client 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/ */

    

tilson / laravel-youtube-client example snippets


    // config/app.php
    'providers' => ServiceProvider::defaultProviders()->merge([
        // ...
       Tilson\YoutubeApi\Providers\YoutubeApiServiceProvider::class,
       
       // ...
    ])->toArray(),


use \Tilson\YoutubeApi\Client;

$client = app(Client::class);
//or Injecting Dependency
public function __construct(private Client $client)
{
// you code
}



use \Tilson\YoutubeApi\Client;
use \Tilson\YoutubeApi\Enums\OrderBy;

$client->lisChannelVideos()
->order(OrderBy::DATE)
->limit(10);
->get();

use \Tilson\YoutubeApi\Client;

$client->listPlaylists()->limit(10)->get();

shell
php artisan vendor:publish --provider="Tilson\YoutubeApi\Providers\YoutubeApiServiceProvider"