{"id":20433944,"url":"https://github.com/cable8mm/youtube","last_synced_at":"2026-05-04T18:32:22.938Z","repository":{"id":220905388,"uuid":"752886800","full_name":"cable8mm/Youtube","owner":"cable8mm","description":"Renewal Laravel PHP Facade/Wrapper for the Youtube Data API","archived":false,"fork":false,"pushed_at":"2024-03-09T14:50:52.000Z","size":265,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-15T19:22:27.999Z","etag":null,"topics":["api","laravel","package","php8","youtube","youtube-api"],"latest_commit_sha":null,"homepage":"http://www.palgle.com/Youtube/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cable8mm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-05T03:10:09.000Z","updated_at":"2024-03-11T04:08:11.000Z","dependencies_parsed_at":"2024-02-22T06:24:59.690Z","dependency_job_id":"d3b05a5c-9726-435e-becf-ad20fa5c127d","html_url":"https://github.com/cable8mm/Youtube","commit_stats":null,"previous_names":["cable8mm/youtube"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cable8mm%2FYoutube","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cable8mm%2FYoutube/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cable8mm%2FYoutube/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cable8mm%2FYoutube/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cable8mm","download_url":"https://codeload.github.com/cable8mm/Youtube/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241976567,"owners_count":20051665,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","laravel","package","php8","youtube","youtube-api"],"created_at":"2024-11-15T08:22:44.734Z","updated_at":"2026-05-04T18:32:22.924Z","avatar_url":"https://github.com/cable8mm.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Youtube\n\n[![code-style](https://github.com/cable8mm/Youtube/actions/workflows/code-style.yml/badge.svg)](https://github.com/cable8mm/Youtube/actions/workflows/code-style.yml)\n[![run-tests](https://github.com/cable8mm/Youtube/actions/workflows/run-tests.yml/badge.svg)](https://github.com/cable8mm/Youtube/actions/workflows/run-tests.yml)\n![Packagist Dependency Version](https://img.shields.io/packagist/dependency-v/cable8mm/Youtube/illuminate%2Fsupport)\n![Packagist Version](https://img.shields.io/packagist/v/cable8mm/Youtube)\n![Packagist Downloads](https://img.shields.io/packagist/dt/cable8mm/Youtube)\n![Packagist Dependency Version](https://img.shields.io/packagist/dependency-v/cable8mm/Youtube/php)\n![Packagist Stars](https://img.shields.io/packagist/stars/cable8mm/Youtube)\n![Packagist License](https://img.shields.io/packagist/l/cable8mm/Youtube)\n\nRenew Laravel PHP Facade/Wrapper for the Youtube Data API v3 ( Non-OAuth )\n\nWe have provided the API Documentation on the web. For more information, please visit \u003chttps://www.palgle.com/Youtube/\u003e ❤️\n\n## Requirements\n\n- PHP 8.2 or higher\n- Laravel 8 or higher\n- API key from [Google Console](https://console.developers.google.com)\n\n## Installation\n\nRun in console below command to download package to your project:\n\n```bash\ncomposer require cable8mm/youtube\n```\n\n## Configuration\n\nPublish config settings:\n\n```bach\nphp artisan vendor:publish --provider=\"Cable8mm\\Youtube\\YoutubeServiceProvider\"\n```\n\nSet your Youtube API key in the file:\n\n```shell\n/config/youtube.php\n```\n\nOr in the .env file\n\n```shell\nYOUTUBE_API_KEY = \u003cYOUR KEY\u003e\n```\n\n## Package Development\n\nIf you are going to contribute,\n\n```sh\ncomposer update\n```\n\nAnd you can use `.env` in the package.\n\n## Usage\n\n```php\n// use Cable8mm\\Youtube\\Facades\\Youtube;\n\n\n// Return an STD PHP object\n$video = Youtube::getVideoInfo('rie-hPVJ7Sw');\n\n// Get multiple videos info from an array\n$videoList = Youtube::getVideoInfo(['rie-hPVJ7Sw','iKHTawgyKWQ']);\n\n// Get localized video info\n$video = Youtube::getLocalizedVideoInfo('vjF9GgrY9c0', 'pl');\n\n// Get comment threads by videoId\n$commentThreads = Youtube::getCommentThreadsByVideoId('zwiUB_Lh3iA');\n\n// Get popular videos in a country, return an array of PHP objects\n$videoList = Youtube::getPopularVideos('us');\n\n// Search playlists, channels and videos. return an array of PHP objects\n$results = Youtube::search('Android');\n\n// Only search videos, return an array of PHP objects\n$videoList = Youtube::searchVideos('Android');\n\n// Search only videos in a given channel, return an array of PHP objects\n$videoList = Youtube::searchChannelVideos('keyword', 'UCk1SpWNzOs4MYmr0uICEntg', 40);\n\n// List videos in a given channel, return an array of PHP objects\n$videoList = Youtube::listChannelVideos('UCk1SpWNzOs4MYmr0uICEntg', 40);\n\n$results = Youtube::searchAdvanced([ /* params */ ]);\n\n// Get channel data by channel name, return an STD PHP object\n$channel = Youtube::getChannelByName('xdadevelopers');\n\n// Get channel data by channel ID, return an STD PHP object\n$channel = Youtube::getChannelById('UCk1SpWNzOs4MYmr0uICEntg');\n\n// Get playlist by ID, return an STD PHP object\n$playlist = Youtube::getPlaylistById('PL590L5WQmH8fJ54F369BLDSqIwcs-TCfs');\n\n// Get playlists by multiple ID's, return an array of STD PHP objects\n$playlists = Youtube::getPlaylistById(['PL590L5WQmH8fJ54F369BLDSqIwcs-TCfs', 'PL590L5WQmH8cUsRyHkk1cPGxW0j5kmhm0']);\n\n// Get playlist by channel ID, return an array of PHP objects\n$playlists = Youtube::getPlaylistsByChannelId('UCk1SpWNzOs4MYmr0uICEntg');\n\n// Get items in a playlist by playlist ID, return an array of PHP objects\n$playlistItems = Youtube::getPlaylistItemsByPlaylistId('PL590L5WQmH8fJ54F369BLDSqIwcs-TCfs');\n\n// Get channel activities by channel ID, return an array of PHP objects\n$activities = Youtube::getActivitiesByChannelId('UCk1SpWNzOs4MYmr0uICEntg');\n\n// Retrieve video ID from original YouTube URL\n$videoId = Youtube::parseVidFromURL('https://www.youtube.com/watch?v=moSFlvxnbgk');\n// result: moSFlvxnbgk\n```\n\n## Validation Rules\n\n```php\n// use Cable8mm\\Youtube\\Rules\\ValidYoutubeVideo;\n\n\n// Validate a YouTube Video URL\n[\n    'youtube_video_url' =\u003e ['bail', 'required', new ValidYoutubeVideo]\n];\n```\n\nYou can use the bail rule in conjunction with this in order to prevent unnecessary queries.\n\n## Basic Search Pagination\n\n```php\n// Set default parameters\n$params = [\n    'q'             =\u003e 'Android',\n    'type'          =\u003e 'video',\n    'part'          =\u003e 'id, snippet',\n    'maxResults'    =\u003e 50\n];\n\n// Make intial call. with second argument to reveal page info such as page tokens\n$search = Youtube::searchAdvanced($params, true);\n\n// Check if we have a pageToken\nif (isset($search['info']['nextPageToken'])) {\n    $params['pageToken'] = $search['info']['nextPageToken'];\n}\n\n// Make another call and repeat\n$search = Youtube::searchAdvanced($params, true);\n\n// Add results key with info parameter set\nprint_r($search['results']);\n\n/* Alternative approach with new built-in paginateResults function */\n\n// Same params as before\n$params = [\n    'q'             =\u003e 'Android',\n    'type'          =\u003e 'video',\n    'part'          =\u003e 'id, snippet',\n    'maxResults'    =\u003e 50\n];\n\n// An array to store page tokens so we can go back and forth\n$pageTokens = [];\n\n// Make inital search\n$search = Youtube::paginateResults($params, null);\n\n// Store token\n$pageTokens[] = $search['info']['nextPageToken'];\n\n// Go to next page in result\n$search = Youtube::paginateResults($params, $pageTokens[0]);\n\n// Store token\n$pageTokens[] = $search['info']['nextPageToken'];\n\n// Go to next page in result\n$search = Youtube::paginateResults($params, $pageTokens[1]);\n\n// Store token\n$pageTokens[] = $search['info']['nextPageToken'];\n\n// Go back a page\n$search = Youtube::paginateResults($params, $pageTokens[0]);\n\n// Add results key with info parameter set\nprint_r($search['results']);\n```\n\nThe 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.\n\n## Manual Class Instantiation\n\n```php\n// Directly call the YouTube constructor\n$youtube = new Youtube(config('YOUTUBE_API_KEY'));\n\n// By default, if the $_SERVER['HTTP_HOST'] header is set,\n// it will be used as the `Referer` header. To override\n// this setting, set 'use-http-host' to false during\n// object construction:\n$youtube = new Youtube(config('YOUTUBE_API_KEY'), ['use-http-host' =\u003e false]);\n\n// This setting can also be set after the object was created\n$youtube-\u003euseHttpHost(false);\n```\n\n## Test\n\n```sh\ncomposer test\n```\n\n## Format of returned data\n\nThe returned JSON is decoded as PHP objects (not Array).\nPlease read the [\"Reference\" section](https://developers.google.com/youtube/v3/docs/) of the Official API doc.\n\n## Youtube Data API v3\n\n- [Youtube Data API v3 Doc](https://developers.google.com/youtube/v3/)\n- [Obtain API key from Google API Console](https://console.developers.google.com)\n\n## Credits\n\nBuilt on code from Alaouy's [alaouy/youtube](https://github.com/alaouy/youtube).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcable8mm%2Fyoutube","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcable8mm%2Fyoutube","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcable8mm%2Fyoutube/lists"}