alchemyguy/youtube-laravel-api

Modern Laravel wrapper for the YouTube Data API v3 with OAuth, live streaming, channels, and video uploads.
7,702 63
Install
composer require alchemyguy/youtube-laravel-api
Latest Version:v2.0.0
PHP:^8.3
License:MIT
Last Updated:Jul 18, 2026
Links: GitHub  ·  Packagist
Maintainer: alchemyguy

YoutubeLaravelApi

Tests Static analysis Latest version License

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

Related Packages

navneetrai/laravel-submitter

Oauth based authenticator and file submitter for Laravel 5.2

36 1
cupoftea/youtube

Laravel YouTube Data API v3 library

47 3
socialiteproviders/youtube

YouTube OAuth2 Provider for Laravel Socialite

751,382 17
laravel/socialite

Laravel wrapper around OAuth 1 & OAuth 2 libraries.

120,528,743 5,746
artdarek/oauth-4-laravel

OAuth Service Provider for Laravel 4

522,424 677