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

ActiveLibrary

billyriantono/youtube
=====================

YouTube API Wrapper with Laravel 5.

1.0.2(10y ago)046MITPHPPHP &gt;=5.4.0

Since May 25Pushed 10y ago1 watchersCompare

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

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

Laravel 5 - YouTube API Wrapper
===============================

[](#laravel-5---youtube-api-wrapper)

Based on Dawson/Youtube

If you've ever needed to upload videos to a single YouTube channel or you need request data from your Laravel 5 application, then hopefully this is the package for you.

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

[](#installation)

Add the following to your `composer.json`.

```
"billyriantono/youtube": "dev-master"
```

After you've added the above, run `composer update` to pull it in. Once your update has finished, we'll need to add the service provider to your `config/app.php`

```
'providers' => [
	'billyriantono\Youtube\YoutubeServiceProvider',
],
```

Then add the alias...

```
'aliases' => [
	'Youtube' => 'billyriantono\Youtube\YoutubeFacade',
],
```

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

[](#configuration)

Run `php artisan vendor:publish` to publish the migrations and config. Then migrate the database with, `php artisan migrate`.

This will create our `youtube_access_tokens` and `channels` table which will of course, hold our access tokens once we've authenticated with Google.

Next it's time to configure our settings in `config/youtube.php` makes use of environment variables to ensure no secret crentials make way into version control. So add the following variables to your `.env` file.

```
GOOGLE_CLIENT_ID=YOUR_CLIENT_ID
GOOGLE_CLIENT_SECRET=YOUR_SECRET
YOUTUBE_APPLICATION_NAME="Your Application Name"
YOUTUBE_REDIRECT_URI="Your Callback Uri" for example : youtube-callback
YOUTUBE_AUTHENTICATION_URI="Your Authentication Uri"
YOUTUBE_AFTER_REDIRECT_URI="Your Custom Controller after getting access token"
GOOGLE_APPROVAL_PROMPT="auto|force"

```

You can find these values on Google's [developer console](https://console.developers.google.com/project) for your application.

Now set up your applications callback, you can find this on your `config/youtube.php`. By default it's set to `http://yourapp.co.uk/youtube-callback`

```
'redirect_uri' => 'youtube-callback'
```

*If you're unsure of how to use enviroment variables, Jeffrey Way helps clear the fog over at Laracasts with his [Environments and Configuration](https://laracasts.com/series/laravel-5-fundamentals/episodes/6) lesson with Laravel 5.*

Authentication
--------------

[](#authentication)

Now our application is configured, we'll go through the inital authentication with Google. By default, the authorization route is `/youtube-auth` but you can change this in `config/youtube.php` should you wish to.

Proceed with hitting the auth route in your application of which you will be sent to Google to authorize your YouTube account/channel. Once authorized, you will be redirected back to your application assuming you correctly configured your callback.

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

[](#upload-a-video)

Once you have complete the above, your Laravel application will now be authorized to make requests to YouTube. Specifically in this case, uploading a video by passing the **full path to the file you wish to upload.**.

To upload a video, do the following:

```
$id = Youtube::upload($pathToMovieFile);

return $id;
```

The above will return the ID of the uploaded video to YouTube.

You also have the option to pass a second parameter as an array with the following available keys.

- title `string`
- description `string`
- category\_id `integer`
- tags `array`

```
$params = [
	'title'	=> 'Laravel Screencast',
	'description' => 'My First Laravel Tutorial!',
	'category_id' => 10,
	'tags' => [
		'laravel',
		'eloquent',
		'awesome' // Of course!
	]
];

$id = Youtube::upload($pathToMovieFile, $params);

return $id;
```

It's that simple!

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($id);
```

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

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

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

Every ~58 days

Total

3

Last Release

3886d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/210e72e289f09b073be09d28e3ba65ac77c7c5e671be0960f959dfce32ea119e?d=identicon)[billyriantono](/maintainers/billyriantono)

---

Top Contributors

[![joedawson](https://avatars.githubusercontent.com/u/1009696?v=4)](https://github.com/joedawson "joedawson (24 commits)")

### Embed Badge

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

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

###  Alternatives

[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1225.0k10](/packages/fleetbase-core-api)

PHPackages © 2026

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