alchemyguy / youtube-laravel-api
Modern Laravel wrapper for the YouTube Data API v3 with OAuth, live streaming, channels, and video uploads.
Requires
- php: ^8.3
- google/apiclient: ^2.18
- illuminate/contracts: ^11.0|^12.0
- illuminate/support: ^11.0|^12.0
- nesbot/carbon: ^2.72|^3.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.16
- mockery/mockery: ^1.6
- orchestra/testbench: ^9.0|^10.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/phpstan: ^2.0
- phpstan/phpstan-mockery: ^2.0
- rector/rector: ^2.0
- dev-master / 2.0.x-dev
- v2.0.0
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0.2
- 1.0.0
- v0.0.3
- v0.0.2
- v0.0.1
- dev-dependabot/github_actions/actions/upload-pages-artifact-5
- dev-dependabot/github_actions/actions/setup-node-6
- dev-dependabot/github_actions/actions/deploy-pages-5
- dev-dependabot/github_actions/actions/checkout-6
- dev-feat/2.0-modernization
This package is auto-updated.
Last update: 2026-05-02 10:09:10 UTC
README
Modern Laravel wrapper for the YouTube Data API v3 with OAuth, live broadcast control, channel management, and resumable video uploads.
Documentation: https://alchemyguy.github.io/YoutubeLaravelApi/
Requirements
- PHP 8.3 or higher
- Laravel 11.x or 12.x
Install
composer require alchemyguy/youtube-laravel-api php artisan vendor:publish --tag=youtube-config
Add credentials to your .env:
YOUTUBE_APP_NAME="My App" YOUTUBE_CLIENT_ID="your-client-id.apps.googleusercontent.com" YOUTUBE_CLIENT_SECRET="your-client-secret" YOUTUBE_API_KEY="your-server-api-key" YOUTUBE_REDIRECT_URL="https://yourapp.test/oauth/youtube/callback"
Quick example
use Alchemyguy\YoutubeLaravelApi\Services\AuthenticateService; use Alchemyguy\YoutubeLaravelApi\Services\LiveStream\LiveStreamService; use Alchemyguy\YoutubeLaravelApi\DTOs\BroadcastData; // 1. OAuth $auth = app(AuthenticateService::class); $url = $auth->getLoginUrl('creator@example.com', 'channel-id'); // ... redirect, handle callback ... $result = $auth->authenticateWithCode($code); // 2. Schedule a live broadcast $live = app(LiveStreamService::class); $broadcast = $live->broadcast($result['token'], new BroadcastData( title: 'My Stream', description: 'Live coding', scheduledStartTime: new DateTimeImmutable('+10 minutes'), ));
Documentation
The full guide, API reference, and examples live at alchemyguy.github.io/YoutubeLaravelApi.
Upgrading from 1.x
If you're on the previous version, see UPGRADE.md — there are several breaking changes.
Contributing
Contributions welcome — see CONTRIBUTING.md. Please run composer lint and composer test:unit before opening a PR.
Security
If you discover a security vulnerability, please email the maintainer directly rather than opening an issue.
License
The MIT License (MIT). See LICENSE for details.
Credits
- Created by Mukesh Chandra
- 2.0 modernization by the contributors