Download the PHP package vinelab/youtube without Composer
On this page you can find all versions of the php package vinelab/youtube. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package youtube
Laravel Youtube Library
This library is used for fetching videos and channels from youtube using a URL.
Installation
- Include using Composer:
"vinelab/youtube" : "*"
- Add the service provider
'Vinelab\Youtube\YoutubeServiceProvider'
- Add the Facade
'Youtube' => 'Vinelab\Youtube\Facades\Youtube'
- Publish the config file
php artisan config:publish Vinelab/youtube
- Add your key to the config file
Usage
Use the Youtube
Facade to access the package's functionalities.
Youtube::video($url)
To fetch a video use
Youtube::video($url)
this will return an object of typeNajem\Videos\Video
.You can fetch multiple
videos
at once by passing anarray
ofUrl's
, toYoutube::videos($urls)
or evenYoutube::video($urls)
.
Response:
Youtube::channel($url)
To fetch a channel use
Youtube::channel($url)
this will return an object of typeNajem\Videos\Channel
.
Response:
Youtube::playlist($url)
To fetch a playlist use
Youtube::playlist($url)
this will return an object of typeNajem\Videos\Playlist
.
Response:
Youtube::sync($resource)
To sync any retrieved resource use
Youtube::sync($resource)
.
- You can sync and it will return the changed object .
- if the saved data was changed manually, you won't be able to sync the data, this means that the
value is set to . - if a video and a channel were passed to the sync method, or an empty(deleted) channel or video an will be thrown.
URL Validation
- To validate the given URLs, you can use use Class.
- Use the method and pass the urls to it.
Example:
If the validation failes, an will be thrown.