PHP code example of jorarmarfin / laravel_youtube

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

    

jorarmarfin / laravel_youtube example snippets


'providers' => [
    //...
    JorarMarfin\LaravelYoutube\LaravelYoutubeServiceProvider::class,
]

//...

'aliases' => [
    //...
    'LaravelYoutube' => JorarMarfin\LaravelYoutube\Facades\LaravelYoutubeFacade::class
]

use LaravelYoutube; // at the top of the file

$data = LaravelYoutube::getData('https://www.youtube.com/watch?v=cYgkfQUUwWQ');
$data is object
+"thumbnail_url": "https://i.ytimg.com/vi/cYgkfQUUwWQ/hqdefault.jpg"
  +"version": "1.0"
  +"type": "video"
  +"html": "<iframe width="480" height="270" src="https://www.youtube.com/embed/cYgkfQUUwWQ?feature=oembed" frameborder="0" allow="accelerometer; autoplay; encrypted-media; ▶"
  +"provider_url": "https://www.youtube.com/"
  +"thumbnail_width": 480
  +"width": 480
  +"thumbnail_height": 360
  +"author_url": "https://www.youtube.com/user/CocinoThai"
  +"height": 270
  +"author_name": "Kwan Homsai"
  +"title": "Receta de Pollo Teriyaki - Chicken Teriyaki Recipe l Kwan Homsai"
  +"provider_name": "YouTube"