PHPackages                             rajagonda/gondayoutube - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. rajagonda/gondayoutube

ActiveLibrary[API Development](/categories/api)

rajagonda/gondayoutube
======================

Laravel PHP Facade/Wrapper for the Youtube Data API v3

v1.7(6y ago)09MITPHPPHP ^7.2CI failing

Since Nov 19Pushed 6y ago1 watchersCompare

[ Source](https://github.com/rajagonda/gondayoutube)[ Packagist](https://packagist.org/packages/rajagonda/gondayoutube)[ RSS](/packages/rajagonda-gondayoutube/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (5)Used By (0)

Youtube
=======

[](#youtube)

[![Travis Youtube Build](https://camo.githubusercontent.com/262c35016f2628a7709cc416edf9629d3eb33c2d57a3e4441fad18a57d7560e7/68747470733a2f2f6170692e7472617669732d63692e6f72672f476f6e64612f476f6e6461596f75747562652e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/262c35016f2628a7709cc416edf9629d3eb33c2d57a3e4441fad18a57d7560e7/68747470733a2f2f6170692e7472617669732d63692e6f72672f476f6e64612f476f6e6461596f75747562652e7376673f6272616e63683d6d6173746572)

Laravel PHP Facade/Wrapper for the Youtube Data API v3 ( Non-OAuth )

Requirements
------------

[](#requirements)

- PHP 7.2 or higher
- Laravel 6.0 or higher
- API key from [Google Console](https://console.developers.google.com)

Looking for Youtube Package for either of these: PHP 5, Laravel 5.0, Laravel 4? Visit the [`php5-branch`](https://github.com/gonda/GondaYoutube/tree/php5)

Installation
------------

[](#installation)

Run in console below command to download package to your project:

```
composer require rajagonda/gondayoutube

```

Configuration
-------------

[](#configuration)

In `/config/app.php` add GondaYoutubeServiceProvider:

```
Rajagonda\GondaYoutube\GondaYoutubeServiceProvider::class,

```

Do not forget to add also Youtube facade there:

```
'GondaYoutube' => Rajagonda\GondaYoutube\Facades\GondaYoutube::class,

```

Publish config settings:

```
$ php artisan vendor:publish --provider="Rajagonda\GondaYoutube\GondaYoutubeServiceProvider"

```

Set your Youtube API key in the file:

```
/config/gondayoutube.php

```

Or in the .env file

```
YOUTUBE_API_KEY = KEY

```

Or you can set the key programmatically at run time :

```
GondaYoutube::setApiKey('KEY');

```

Usage
-----

[](#usage)

```
// use Rajagonda\GondaYoutube\Facades\GondaYoutube;

// Return an STD PHP object
$video = GondaYoutube::getVideoInfo('rie-hPVJ7Sw');

// Get multiple videos info from an array
$videoList = GondaYoutube::getVideoInfo(['rie-hPVJ7Sw','iKHTawgyKWQ']);

// Get multiple videos related to a video
$relatedVideos = GondaYoutube::getRelatedVideos('iKHTawgyKWQ');

// Get comment threads by videoId
$commentThreads = GondaYoutube::getCommentThreadsByVideoId('zwiUB_Lh3iA');

// Get popular videos in a country, return an array of PHP objects
$videoList = GondaYoutube::getPopularVideos('us');

// Search playlists, channels and videos. return an array of PHP objects
$results = GondaYoutube::search('Android');

// Only search videos, return an array of PHP objects
$videoList = GondaYoutube::searchVideos('Android');

// Search only videos in a given channel, return an array of PHP objects
$videoList = GondaYoutube::searchChannelVideos('keyword', 'UCk1SpWNzOs4MYmr0uICEntg', 40);

// List videos in a given channel, return an array of PHP objects
$videoList = GondaYoutube::listChannelVideos('UCk1SpWNzOs4MYmr0uICEntg', 40);

$results = GondaYoutube::searchAdvanced([ /* params */ ]);

// Get channel data by channel name, return an STD PHP object
$channel = GondaYoutube::getChannelByName('xdadevelopers');

// Get channel data by channel ID, return an STD PHP object
$channel = GondaYoutube::getChannelById('UCk1SpWNzOs4MYmr0uICEntg');

// Get playlist by ID, return an STD PHP object
$playlist = GondaYoutube::getPlaylistById('PL590L5WQmH8fJ54F369BLDSqIwcs-TCfs');

// Get playlists by multiple ID's, return an array of STD PHP objects
$playlists = GondaYoutube::getPlaylistById(['PL590L5WQmH8fJ54F369BLDSqIwcs-TCfs', 'PL590L5WQmH8cUsRyHkk1cPGxW0j5kmhm0']);

// Get playlist by channel ID, return an array of PHP objects
$playlists = GondaYoutube::getPlaylistsByChannelId('UCk1SpWNzOs4MYmr0uICEntg');

// Get items in a playlist by playlist ID, return an array of PHP objects
$playlistItems = GondaYoutube::getPlaylistItemsByPlaylistId('PL590L5WQmH8fJ54F369BLDSqIwcs-TCfs');

// Get channel activities by channel ID, return an array of PHP objects
$activities = GondaYoutube::getActivitiesByChannelId('UCk1SpWNzOs4MYmr0uICEntg');

// Retrieve video ID from original YouTube URL
$videoId = GondaYoutube::parseVidFromURL('https://www.youtube.com/watch?v=moSFlvxnbgk');
// result: moSFlvxnbgk
```

Basic Search Pagination
-----------------------

[](#basic-search-pagination)

```
// Set default parameters
$params = [
    'q'             => 'Android',
    'type'          => 'video',
    'part'          => 'id, snippet',
    'maxResults'    => 50
];

// Make intial call. with second argument to reveal page info such as page tokens
$search = GondaYoutube::searchAdvanced($params, true);

// Check if we have a pageToken
if (isset($search['info']['nextPageToken'])) {
    $params['pageToken'] = $search['info']['nextPageToken'];
}

// Make another call and repeat
$search = GondaYoutube::searchAdvanced($params, true);

// Add results key with info parameter set
print_r($search['results']);

/* Alternative approach with new built-in paginateResults function */

// Same params as before
$params = [
    'q'             => 'Android',
    'type'          => 'video',
    'part'          => 'id, snippet',
    'maxResults'    => 50
];

// An array to store page tokens so we can go back and forth
$pageTokens = [];

// Make inital search
$search = GondaYoutube::paginateResults($params, null);

// Store token
$pageTokens[] = $search['info']['nextPageToken'];

// Go to next page in result
$search = GondaYoutube::paginateResults($params, $pageTokens[0]);

// Store token
$pageTokens[] = $search['info']['nextPageToken'];

// Go to next page in result
$search = GondaYoutube::paginateResults($params, $pageTokens[1]);

// Store token
$pageTokens[] = $search['info']['nextPageToken'];

// Go back a page
$search = GondaYoutube::paginateResults($params, $pageTokens[0]);

// Add results key with info parameter set
print_r($search['results']);
```

The pagination above is quite basic. Depending on what you are trying to achieve you may want to create a recursive function that traverses the results.

Run Unit Test
-------------

[](#run-unit-test)

If you have PHPUnit installed in your environment, run:

```
$ phpunit
```

If you don't have PHPUnit installed, you can run the following:

```
$ composer update
$ ./vendor/bin/phpunit
```

Format of returned data
-----------------------

[](#format-of-returned-data)

The returned JSON is decoded as PHP objects (not Array). Please read the ["Reference" section](https://developers.google.com/youtube/v3/docs/) of the Official API doc.

Youtube Data API v3
-------------------

[](#youtube-data-api-v3)

- [Youtube Data API v3 Doc](https://developers.google.com/youtube/v3/)
- [Obtain API key from Google API Console](https://console.developers.google.com)

Credits
-------

[](#credits)

Built on code from Madcoda's [php-youtube-api](https://github.com/madcoda/php-youtube-api).

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

2363d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ac41f5d99ed251ebfa457ffcfbee13be9d7f0a726214589ce3ef9da803ae082e?d=identicon)[rajagonda](/maintainers/rajagonda)

---

Top Contributors

[![rajagondan](https://avatars.githubusercontent.com/u/214053979?v=4)](https://github.com/rajagondan "rajagondan (5 commits)")

---

Tags

apilaravelvideoyoutuberajagonda

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rajagonda-gondayoutube/health.svg)

```
[![Health](https://phpackages.com/badges/rajagonda-gondayoutube/health.svg)](https://phpackages.com/packages/rajagonda-gondayoutube)
```

###  Alternatives

[alaouy/youtube

Laravel PHP Facade/Wrapper for the Youtube Data API v3

8091.3M9](/packages/alaouy-youtube)[madcoda/php-youtube-api

PHP wrapper for the Youtube Data API v3

4451.2M8](/packages/madcoda-php-youtube-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
