PHPackages                             newbiecoder99/uptube - 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. newbiecoder99/uptube

ActiveLibrary[API Development](/categories/api)

newbiecoder99/uptube
====================

Upload a video to YouTube with Laravel 5.

020PHP

Since Sep 16Pushed 7y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

Laravel 5 - YouTube Video Upload
================================

[](#laravel-5---youtube-video-upload)

**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 newbiecoder99/uptube

```

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

```
'providers' => [
    ...
    Newbiecoder99\Uptube\UptubeServiceProvider::class,
],
```

And also add the alias to the same file.

```
'aliases' => [
    ...
    'Uptube' => Newbiecoder99\Uptube\Facades\Uptube::class,
],
```

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

[](#configuration)

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

```
php artisan vendor:publish --provider="Newbiecoder99\Uptube\UptubeServiceProvider"

```

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 = Uptube::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 = Uptube::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 = Uptube::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.

Updating a Video
================

[](#updating-a-video)

To update a video, you simply need to pass the **videoId** of the video you wish to update and specify your video information.

Here's an example:

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

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

Note: This request is explicit. Any params left out of the request will be removed.

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:

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

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

Thanks to : [Joe Dawson](//github.com/JoeDawson/youtube)Update it because use Youtube Pakcage conflict with [Alaouy](//github.com/alaouy/Youtube) ^\_^

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6c289128a0867b1b7869065b7f12a5578ae6e8e6d64796f2642cfb441a6dae52?d=identicon)[NewbieCoder99](/maintainers/NewbieCoder99)

---

Top Contributors

[![NewbieCoder99](https://avatars.githubusercontent.com/u/9962311?v=4)](https://github.com/NewbieCoder99 "NewbieCoder99 (3 commits)")

### Embed Badge

![Health badge](/badges/newbiecoder99-uptube/health.svg)

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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