PHP code example of rafael.paulino / youtube

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

    

rafael.paulino / youtube example snippets



YouTube\CountChannelSubscribers;

//get api key here https://console.developers.google.com/apis/credentials
$api_key = 'your api key';

//get youtube channel id here: http://johnnythetank.github.io/youtube-channel-name-converter/
$channel_id = 'your channel id';

$subscribers = new CountChannelSubscribers($api_key, $channel_id);
$resultado = $subscribers->getSubscriberCount();
var_dump($resultado);