This YoutubeAPI
is a simple way to interact with Youtube (v3) API.
The easy way to install YoutubeAPI
is to use composer. So please consider the
following command:
composer require 'nekland/youtube-api:*'
This will add nekland/youtube-api
to your composer.json file and automatically download it to your vendor
folder.
- You have to declare a new instance of "Youtube" object;
- You have to configure the authentication you want to use;
- Enjoy apis compatible with your authentication configuration
Here is an example:
$youtube = new Youtube();
// Authentication with encrypted certificate
$youtube->authenticate(
'ServiceAuth',
['cert_file' => 'my_google_certificate', 'email' => 'myemail_for_google_service@googleapi_etc.com']
);
// The info variable will contains an array of data returned by google
$info = $youtube->api('video')->findVideoById('RnpyRe_7jZA');
For now all APIs are compatible with all authentications.
You can learn more about authentication methods here.
To see what API follow your need you can checkout theses pages of documentation:
- Video API: retrieve data from a video
- Playlist API: retrieve data from an api
APIs are well documented inside the classes. Checkout the Api folder.