PHP code example of madcodez / youtube

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

    

madcodez / youtube example snippets




ube = new Madcodez\YouTube\YouTube('* Your API key here *');

$chart = $youtube->chart('10', $pageToken);

print_r($chart);



ube = new Madcodez\YouTube\YouTube('* Your API key here *');

$catVid = $youtube->videoByCat('2', '10', $pageToken);

print_r($catVid);


tube = new Madcodez\YouTube\YouTube('* Your API key here *');

$seach = $youtube->search('Web Development', '10', $pageToken);

print_r($search);



ube = new Madcodez\YouTube\YouTube('* Your API key here *');

$video = $youtube->video('rie-hPVJ7Sw');

print_r($video);



ube = new Madcodez\YouTube\YouTube('* Your API key here *');

$channel = $youtube->channel('UC0gTtCL29NCuex5OApWXpPQ', '10', $pageToken);

print_r($channel);



ube = new Madcodez\YouTube\YouTube('* Your API key here *');

$related = $youtube->related('nLzV5l0Enww', '10', $pageToken);

print_r($related);