PHP code example of it-tech / youtubeparser

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

    

it-tech / youtubeparser example snippets

 
use ITTechnology\Tube\YouTubeParse;

// Initialize application
$tube    = YouTubeParse::init("Your YouTube API key", 30);

// Get channel
$chanel = $tube->chanel('YouTube channel ID');
echo '<h1>Channel '.$chanel->items[0]->snippet->title.'</h1>';
echo "<pre>";
print_r($chanel);
echo "</pre>";

// Get channel playlists
$playlist = $tube->playlists("YouTube channel ID");
echo '<h1>Channel playlists '.$playlist->items[0]->snippet->channelTitle.'</h1>';
echo "<pre>";
print_r($playlist);
echo "</pre>";

echo '<h1>Playlist video '.$playlist->items[0]->snippet->title.'</h1>';

// Get video playlists
$video = $tube->video($playlist->items[0]->id);
echo "<pre>";
print_r($video);
echo "</pre>";