PHP code example of madcoda / php-youtube-api

1. Go to this page and download the library: Download madcoda/php-youtube-api 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/ */

    

madcoda / php-youtube-api example snippets




$youtube = new Madcoda\Youtube\Youtube(array('key' => 'YOUR API KEY'));
$video = $youtube->getVideoInfo('rie-hPVJ7Sw');

$video = Youtube::getVideoInfo(request('vid', 'dQw4w9WgXcQ'));

'providers' => [
    Madcoda\Youtube\YoutubeServiceProviderLaravel5::class,
],
'aliases' => [
    'Youtube' => Madcoda\Youtube\Facades\Youtube::class,
],

use Madcoda\Youtube\Http\HttpClientInterface;

class MyClient implements HttpClientInterface
{
    public function get($url, array $params)
    {
        // return the raw, undecoded response body
    }
}

$youtube = new Madcoda\Youtube\Youtube(array('key' => 'YOUR API KEY'));
$youtube->setHttpClient(new MyClient());
sh
php artisan vendor:publish --provider="Madcoda\Youtube\YoutubeServiceProviderLaravel5"