PHPackages                             lcmaquino/youtubechannel - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. lcmaquino/youtubechannel

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

lcmaquino/youtubechannel
========================

YouTubeChannel adds to Laravel the service provider for OAuth 2.0 authentication with YouTube Google account.

v1.0.7(5y ago)065GPL-3.0-or-laterPHPPHP ^7.2

Since Jan 2Pushed 5y ago1 watchersCompare

[ Source](https://github.com/lcmaquino/youtubechannel)[ Packagist](https://packagist.org/packages/lcmaquino/youtubechannel)[ Docs](https://github.com/lcmaquino/youtubechannel)[ RSS](/packages/lcmaquino-youtubechannel/feed)WikiDiscussions main Synced 5d ago

READMEChangelogDependenciesVersions (9)Used By (0)

Introduction
------------

[](#introduction)

YouTubeChannel adds to Laravel the service provider for OAuth 2.0 authentication with YouTube Google account.

It was created based on [GoogleOAuth2](https://github.com/lcmaquino/googleoauth2) that is a Laravel package for OAuth 2.0 authentication with Google account.

### Features

[](#features)

- The same features of [GoogleOAuth2](https://github.com/lcmaquino/googleoauth2);
- Check if an user is subscribed on a given YouTube channel;
- Get some YouTube channel statistics: subscription count, views count and videos count.

For more information about Google OAuth 2.0, please see

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

[](#installation)

```
$ cd /path/to/your/laravel/root
$ composer require lcmaquino/youtubechannel
$ php artisan vendor:publish --provider="Lcmaquino\YouTubeChannel\YouTubeChannelProvider"

```

Laravel should automatically include `Lcmaquino\YouTubeChannel\YouTubeChannelProvider`as a service provider and include `YouTubeChannel` as an alias for `Lcmaquino\YouTubeChannel\Facades\YouTubeChannel::class`.

It can be done manually editing `config/app.php` to look like:

```
    'providers' => [

        //More Service Providers...

        /*
         * Package Service Providers...
         */
        Lcmaquino\YouTubeChannel\YouTubeChannelProvider::class,
    ],

    'aliases' => [

        //More aliases...

        'YouTubeChannel' => Lcmaquino\YouTubeChannel\Facades\YouTubeChannel::class,
    ],

```

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

[](#configuration)

Before using YouTubeChannel, you need to set up an [OAuth 2.0 client ID](https://support.google.com/cloud/answer/6158849?hl=en). The OAuth 2.0 client will provide a *client id*, a *client secret*, and a *redirect uri* for your application. These parameters and the *youtube channel id* should be placed in your `.env` Laravel configuration file.

```
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_REDIRECT_URI=
YOUTUBE_CHANNEL_ID=

```

It will be loaded by your application when reading the file `config/googleoauth2.php`:

```
