PHPackages                             ayman-elmalah/laravel-youtube-uploader - 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. [Image &amp; Media](/categories/media)
4. /
5. ayman-elmalah/laravel-youtube-uploader

ActiveLibrary[Image &amp; Media](/categories/media)

ayman-elmalah/laravel-youtube-uploader
======================================

The package will help you to upload videos to youtube and making youtube api much easier

v1.0.1(7y ago)159972[1 issues](https://github.com/ayman-elmalah/laravel-youtube-uploader/issues)MITPHP

Since Jan 4Pushed 7y agoCompare

[ Source](https://github.com/ayman-elmalah/laravel-youtube-uploader)[ Packagist](https://packagist.org/packages/ayman-elmalah/laravel-youtube-uploader)[ RSS](/packages/ayman-elmalah-laravel-youtube-uploader/feed)WikiDiscussions master Synced 2mo ago

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

Laravel Youtube Uploader
========================

[](#laravel-youtube-uploader)

laravel youtube uploader is a php package written by [Ayman Elmalah](https://github.com/ayman-elmalah) with laravel to handle many youtube sdk functionality by making it's api more easy .

Features
--------

[](#features)

- Uploading videos to user channel
- Creating playlists
- Insert video to existing playlist
- Set thumbnail to existing video or at uploading video
- Deleting video

Installation Guide
==================

[](#installation-guide)

At laravel project install package using composer

```
composer require ayman-elmalah/laravel-youtube-uploader

```

The package is compatible with laravel 5.7 so you don't need to set providers or aliases for the package, we're using laravel auto discovery

Get Your Credentials From Google
--------------------------------

[](#get-your-credentials-from-google)

- Go to [Google Developers Console](https://console.developers.google.com/) Press Credentials from the sidebar then create project from OAuth consent screen then Click Credentials =&gt; Create credentials =&gt; OAuth client id, choose it web application and set you Authorized redirect URIs, also you can edit or add new urls later
- You will get Client Id and Client Secret
- Go to your .env file and paste your credentials to be like this

```
GOOGLE_CLIENT_ID=YOUR_CLIENT_ID
GOOGLE_CLIENT_SECRET=YOUR_SECRET

```

You are now ready to use the package

There is two steps to do any thing for the package, get authenticated url and do the youtube api action

### To get the auth url, just go to routes/web.php and do this route or the path you want to use

[](#to-get-the-auth-url-just-go-to-routeswebphp-and-do-this-route-or-the-path-you-want-to-use)

```
Route::get('youtube/auth', 'YoutubeUploaderController@auth');

```

At the controller, you will get the url and you can show it in view file or redirect user to it directly

```
use Youtube;
public function auth() {
    $redirect_url ='http://localhost/youtube-uploader/public/youtube/callback';  // Upload video path

    return redirect(Youtube::setRedirectUrl($redirect_url)->AuthUrl());
  }

```

This code will authenticate user then redirect user to another url to do your logic on it, and to do any logic code, you need to add route url to routes/web.php

```
Route::get('youtube/callback', 'YoutubeUploaderController@callback');

```

Don't forget to save full path of callback url at google console developer at credential for project

The we will now show our logic of the package

Upload video
------------

[](#upload-video)

```
public function callback(Request $request) {
      $redirect_url ='http://localhost/youtube-uploader/public/youtube/callback';
      $video = public_path('VIDEO_FILE');
      $image = public_path('IMAGE_FILE');
    	$youtube = Youtube::setRedirectUrl($redirect_url)->upload($video,
            [
                'title' => 'TITLE',
                'description' => 'DESCRIPTION',
                'tags' => ['tag 1', 'tag 2'],
                'category_id' => '22',
            ]
        );

      // Get uploaded video id
      $video_id = $youtube->uploadedVideoId();
}

```

Set thumbnail to existing video
-------------------------------

[](#set-thumbnail-to-existing-video)

Remember that you need to set auth url at routes for each callback url

```
public function another_callback(Request $request) {
    $redirect_url ='http://localhost/youtube-uploader/public/youtube/callback/another_callback';
    $video_id = 'VIDEO_ID';
    $image = public_path('THUMBNAIL_PATH');
    $youtube = Youtube::setRedirectUrl($redirect_url)->updateThumbnail($video_id, $image);
}

```

Set thumbnail at uploading
--------------------------

[](#set-thumbnail-at-uploading)

Remember that you need to set auth url at routes for each callback url

```
public function another_callback(Request $request) {
      $redirect_url ='http://localhost/youtube-uploader/public/youtube/callback/another_callback';
      $video = public_path('VIDEO_PATH');
      $image = public_path('THUMBNAIL_PATH');
      $youtube = Youtube::setRedirectUrl($redirect_url)->upload($video,
             [
                 'title' => 'TITLE',
                 'description' => 'Description1',
                 'tags' => ['tag 1', 'tag2'],
                 'category_id' => '22',
             ]
         )->withThumbnail($image);

         $video_id = $youtube->uploadedVideoId();
}

```

Set tags for existing video
---------------------------

[](#set-tags-for-existing-video)

Remember that you need to set auth url at routes for each callback url

```
public function another_callback(Request $request) {
       $redirect_url ='http://localhost/youtube-uploader/public/youtube/callback/another_callback';
       $video_id = 'YOUR_VIDEO_ID';
       $youtube = Youtube::setRedirectUrl($redirect_url)->updateTags($video_id, ['tag 1', 'tag2', 'Tag3', 'Tag 4']);
}

```

Create Playlist
---------------

[](#create-playlist)

Remember that you need to set auth url at routes for each callback url

```
 public function another_callback(Request $request) {
       $redirect_url ='http://localhost/youtube-uploader/public/youtube/callback/another_callback';
       $youtube = Youtube::setRedirectUrl($redirect_url)
                         ->createPlaylist('TITLE', 'DESCRIPTION');

       // Get playlist id
       $playlist_id = $youtube->createdPlaylistId();
 }

```

Insert Video to playlist
------------------------

[](#insert-video-to-playlist)

Remember that you need to set auth url at routes for each callback url

```
 public function another_callback(Request $request) {
     $redirect_url ='http://localhost/youtube-uploader/public/youtube/callback/another_callback';
     $youtube = Youtube::setRedirectUrl($redirect_url)
                       ->VideoToPlaylist('VIDEO_ID', 'PLAYLIST_ID');
 }

```

Delete video by the given id
----------------------------

[](#delete-video-by-the-given-id)

Remember that you need to set auth url at routes for each callback url

```
public function another_callback(Request $request) {
    $redirect_url ='http://localhost/youtube-uploader/public/youtube/callback/another_callback';
    $video_id = 'VIDEO_ID';
    $youtube = Youtube::setRedirectUrl($redirect_url)->deleteVideo($video_id);
}

```

If you have any question, issue Or request, i'll be happy if hear any thing from you
====================================================================================

[](#if-you-have-any-question-issue-or-request-ill-be-happy-if-hear-any-thing-from-you)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Unknown

Total

1

Last Release

2685d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f310d904881978bb6effb86e20d1afd6bd84a41b652cd4bd48ef004dfda25537?d=identicon)[ayman-elmalah](/maintainers/ayman-elmalah)

---

Top Contributors

[![ayman-elmalah](https://avatars.githubusercontent.com/u/22693197?v=4)](https://github.com/ayman-elmalah "ayman-elmalah (1 commits)")

---

Tags

laravelphpvideoyoutube

### Embed Badge

![Health badge](/badges/ayman-elmalah-laravel-youtube-uploader/health.svg)

```
[![Health](https://phpackages.com/badges/ayman-elmalah-laravel-youtube-uploader/health.svg)](https://phpackages.com/packages/ayman-elmalah-laravel-youtube-uploader)
```

###  Alternatives

[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[goat1000/svggraph

Generates SVG graphs

132849.6k3](/packages/goat1000-svggraph)[netresearch/rte-ckeditor-image

Image support in CKEditor for the TYPO3 ecosystem - by Netresearch

63991.3k4](/packages/netresearch-rte-ckeditor-image)[imagekit/imagekit

PHP library for Imagekit

47795.6k9](/packages/imagekit-imagekit)[spacecatninja/imager-x

Ninja powered image transforms.

29390.0k23](/packages/spacecatninja-imager-x)[contao/image

Contao image library

131.7M9](/packages/contao-image)

PHPackages © 2026

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