jorarmarfin / laravel_youtube
Get the information from a YouTube video
0.0.4
2020-02-08 05:28 UTC
Requires
- php: >=5.6.4
Requires (Dev)
- phpunit/phpunit: ~5.0
This package is auto-updated.
Last update: 2025-04-08 17:11:34 UTC
README
A simple way to show the metadata of a YouTube video in Laravel
Installation
The LaravelYoutube service provider can be installed via composer by requiring the jorarmarfin/laravel_youtube
package in your project's composer.json.
Laravel 5.5+ will use the auto-discovery function.
{ "require": { "jorarmarfin/laravel_youtube": "0.0.2" } }
If you don't use auto-discovery you will need to include the service provider / facade in config/app.php
.
'providers' => [ //... JorarMarfin\LaravelYoutube\LaravelYoutubeServiceProvider::class, ] //... 'aliases' => [ //... 'LaravelYoutube' => JorarMarfin\LaravelYoutube\Facades\LaravelYoutubeFacade::class ]
That's it! You're good to go.
Here is a little example:
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"