PHPackages                             schooch/youtube - 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. schooch/youtube

ActiveLibrary[API Development](/categories/api)

schooch/youtube
===============

Upload a video to YouTube with Laravel 5.

v5.0.7(4y ago)0968MITPHPPHP ^7.0|^8.0

Since May 25Pushed 4y ago1 watchersCompare

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

READMEChangelog (9)Dependencies (6)Versions (28)Used By (0)

Laravel 5 - YouTube Video Upload - Forked from JoeDawson
========================================================

[](#laravel-5---youtube-video-upload---forked-from-joedawson)

**Please note, that this package will only work with a single YouTube account and does not support multiple accounts.**

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

[](#installation)

To install, use the following to pull the package in via Composer.

```
composer require schooch/youtube

```

Now register the Service provider in `config/app.php`

```
'providers' => [
    ...
    schooch\Youtube\YoutubeServiceProvider::class,
],
```

And also add the alias to the same file.

```
'aliases' => [
    ...
    'Youtube' => schooch\Youtube\Facades\Youtube::class,
],
```

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

[](#configuration)

You now need to publish the `youtube.php` config and migrations.

```
php artisan vendor:publish --provider="schooch\Youtube\YoutubeServiceProvider"

```

Now you'll want to run `php artisan migrate` to create the `youtube_access_tokens` table which as you would imagine, will contain your access tokens once you're authenticated correctly.

### Obtaining your Credentials

[](#obtaining-your-credentials)

If you haven't already, you'll need to create an application on [Google's Developer Console](https://console.developers.google.com/project). You then need to head into **Credentials** within the Console to create Server key.

You will be asked to enter your Authorised redirect URIs. When installing this package, the default redirect URI is `http://laravel.dev/youtube/callback`. Of course, replacing the domain (`laravel.dev`) with your applications domain name.

**You can add multiple redirect URIs, for example you may want to add the URIs for your local, staging and production servers.**

Once you are happy with everything, create the credentials and you will be provided with a **Client ID** and **Client Secret**. These now need to be added to your `.env` file.

```
GOOGLE_CLIENT_ID=YOUR_CLIENT_ID
GOOGLE_CLIENT_SECRET=YOUR_SECRET

```

### Authentication

[](#authentication)

For security reasons, the routes to authorize your channel with your Laravel application for disabled by default. You will need to enable them in your `config/youtube.php` before doing the following.

Now your application is configured, we'll go through the inital authentication with Google. By default, the authorization route is `/youtube/auth`. Simply visit this URI in your application and you will be redirect to Google to authenticate your YouTube account.

Assuming you were not presented with any errors during authentication, you will be redirected back to your application root. (`/`).

### Reviewing your Token

[](#reviewing-your-token)

Previously, users of this package have reported issues with their access token(s). To ensure you have the correct token, you simply need to review the `youtube_access_tokens` table you migrated earlier and review the value in the `access_token` column.

**You need to check that a `refresh_token` exists within this value. If this is correct, you're all set to begin uploading.**

You will also want to disable the routes used for authorization as they will no longer be required since you are now autheticated. The token you just reviewed, assuming as a `refresh_token` will automatically be handled.

Upload a Video
==============

[](#upload-a-video)

To upload a video, you simply need to pass the **full** path to your video you wish to upload and specify your video information.

Here's an example:

```
$video = Youtube::upload($fullPathToVideo, [
    'title'       => 'My Awesome Video',
    'description' => 'You can also specify your video description here.',
    'tags'	      => ['foo', 'bar', 'baz'],
    'category_id' => 10
]);

return $video->getVideoId();
```

The above will return the ID of the uploaded video to YouTube. (*i.e dQw4w9WgXcQ*)

By default, video uploads are public. If you would like to change the privacy of the upload, you can do so by passing a third parameter to the upload method.

For example, the below will upload the video as `unlisted`.

```
$video = Youtube::upload($fullPathToVideo, $params, 'unlisted');
```

### Custom Thumbnail

[](#custom-thumbnail)

If you would like to set a custom thumbnail for for upload, you can use the `withThumbnail()` method via chaining.

```
$fullpathToImage = storage_path('app/public/thumbnail.jpg');

$video = Youtube::upload($fullPathToVideo, $params)->withThumbnail($fullpathToImage);

return $youtube->getThumbnailUrl();
```

**Please note, the maxiumum filesize for the thumbnail is 2MB**. Setting a thumbnail will not work if you attempt to use a thumbnail that exceeds this size.

Deleting a Video
================

[](#deleting-a-video)

If you would like to delete a video, which of course is uploaded to your authorized channel, you will also have the ability to delete it:

```
Youtube::delete($videoId);
```

When deleting a video, it will check if exists before attempting to delete.

Questions
=========

[](#questions)

Should you have any questions, please feel free to submit an issue.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 82.8% 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 ~101 days

Recently: every ~369 days

Total

26

Last Release

1472d ago

Major Versions

v2.0.0 → 3.0.02017-07-08

3.1.0-beta → 4.0.02017-08-05

3.1.2-beta → 4.1.02017-09-25

4.1.1 → 5.0.02018-03-26

v2.0.1 → v5.0.12018-04-04

PHP version history (5 changes)1.0.1PHP &gt;=5.4.0

1.1.0PHP &gt;=5.5.9

v2.0.0PHP &gt;=5.6.4

3.0.0PHP ^7.0

v5.0.6PHP ^7.0|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/9a4ea02608b5c63858edf563b89503f9ea8250be0d89bd541d41e54f314cb3fb?d=identicon)[schooch](/maintainers/schooch)

---

Top Contributors

[![joedawson](https://avatars.githubusercontent.com/u/1009696?v=4)](https://github.com/joedawson "joedawson (48 commits)")[![schooch](https://avatars.githubusercontent.com/u/1352333?v=4)](https://github.com/schooch "schooch (4 commits)")[![arcanedev-maroc](https://avatars.githubusercontent.com/u/3282340?v=4)](https://github.com/arcanedev-maroc "arcanedev-maroc (2 commits)")[![stojankukrika](https://avatars.githubusercontent.com/u/10199584?v=4)](https://github.com/stojankukrika "stojankukrika (2 commits)")[![ahmedash95](https://avatars.githubusercontent.com/u/8272048?v=4)](https://github.com/ahmedash95 "ahmedash95 (1 commits)")[![iZaL](https://avatars.githubusercontent.com/u/6410176?v=4)](https://github.com/iZaL "iZaL (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/schooch-youtube/health.svg)

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

###  Alternatives

[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[specialtactics/l5-api

Dependencies for the Laravel API Boilerplate package

3672.8k2](/packages/specialtactics-l5-api)

PHPackages © 2026

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