Download the PHP package mmg/youtube without Composer
On this page you can find all versions of the php package mmg/youtube. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Vendor mmg
Package youtube
Short Description Wrapper class for the mmg group to consume Youtube Api.
License MIT
Package youtube
Short Description Wrapper class for the mmg group to consume Youtube Api.
License MIT
Please rate this library. Is it a good library?
Informations about the package youtube
Background
This is just a "wrapper class" built on top of the "Google SDK" to minimize the effort of integrating the "Youtube" api into your projects.
Pre Requisite
- Xampp/Wampp or Mamp server must be installed.
- Composer is installed and configured properly.
- Minimum PHP 7.2 (Not tested below or with later versions).
- Google Developer Console account.
Setup Google Developer Console Project
- Sign in to Google Developer Console.
- Create "New Project" usually option is available between google cloud logo and the search bar.
- Enter "Project Name" and select "Organization" depending upon your account.
- Click blue "Create" button.
- Configure "0Auth consent screen" by filling asked details and click "Save and continue" button.
-
Add the required Scopes you will be requesting from the user:
https://www.googleapis.com/auth/youtube.readonly
https://www.googleapis.com/auth/youtube.force-ssl
click "Save and continue" after adding above scopes into consent screen.
Note: If scopes are not available in your project click "Enable API & Services" button and enable "Youtube Data API" for your project. - Add "Test users" and click "Save and continue" button.
- Click "Credentials" option provided in left "Navigation Panel".
- Click "+ Create Credentials" button and choose "API Key" & copy it.
- Create "OAuth client ID" while you are on the "Credentials" page and configure "Redirect URIs".
- Click the little "Download Icon" under the heading "OAuth 2.0 Client IDs" and download config file.
- Make sure you have "API Key" and "Config JSON" file on this step.
Example Code
https://github.com/shahzaib91/youtube-wrapper-example
Setup Library
- Run command
composer require mmg/youtube. - Add
require __DIR__.'/vendor/autoload.php';on top of your php file.
Functions Description
| Function Name | Description |
|---|---|
public function prepare($name, $scopes, $configJsonPath, $apiKey)
|
Function to config client via wrapper class |
public function getAuthUrl()
|
Function to get auth url for authentication |
public function getAccessToken($code)
|
Function to fetch access token and set it to client |
public function setAccessToken($accessTokenJson)
|
Function sets access token to google client object |
private function parseAccessTokenJson($accessTokenJson)
|
Helper function to abstractedly perform json parsing |
public function getChannelsList()
|
Function to retrieve list of available channels owned by authenticated user |
public function getVideosList($channelId, $maxItems = 12)
|
Function to retrieve list of videos |
public function getVideoDetail($videoId)
|
Function to retrieve video details |
public function getVideoComments($videoId, $maxItems = 12)
|
Function to retrieve video comments and replies |
public function getVideoComments($videoId, $maxItems = 12)
|
Function is helping in tagging right reply to right comment by id |
All versions of youtube with dependencies
PHP Build Version
Package Version
Requires
google/apiclient Version
2.12.1
The package mmg/youtube contains the following files
Loading the files please wait ...