PHPackages                             tilson/laravel-youtube-client - 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. tilson/laravel-youtube-client

ActiveLibrary[API Development](/categories/api)

tilson/laravel-youtube-client
=============================

A simples way to connect a youtube api

1.0.0(2y ago)104MITPHPPHP ^8.0

Since May 27Pushed 2y ago2 watchersCompare

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

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Laravel Youtube Client
======================

[](#laravel-youtube-client)

This package provides a simple and intuitive way to work on the Youtube Data API. It provides fluent interface to Youtube features.

Objectives to be achieved with this package:

- YouTube Data API v3
    - List video from my channel
    - List my channel playlist
    - Show channel subscription button

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

[](#installation)

```
  composer require tilson/laravel-youtube-client
```

After installing, define in the .env file the environment variables API\_YOUTUBE\_KEY and CHANNEL\_ID, which corresponds to the api key and the ID of your youtube channel

Publish the package:

```
php artisan vendor:publish --provider="Tilson\YoutubeApi\Providers\YoutubeApiServiceProvider"
```

In your `app.php` register our service provider.

```
    // config/app.php
    'providers' => ServiceProvider::defaultProviders()->merge([
        // ...
       Tilson\YoutubeApi\Providers\YoutubeApiServiceProvider::class,

       // ...
    ])->toArray(),
```

### Use the client class

[](#use-the-client-class)

```
use \Tilson\YoutubeApi\Client;

$client = app(Client::class);
//or Injecting Dependency
public function __construct(private Client $client)
{
// you code
}
```

### List video from my channel

[](#list-video-from-my-channel)

```
use \Tilson\YoutubeApi\Client;
use \Tilson\YoutubeApi\Enums\OrderBy;

$client->lisChannelVideos()
->order(OrderBy::DATE)
->limit(10);
->get();
```

### List playlist from my channel

[](#list-playlist-from-my-channel)

```
use \Tilson\YoutubeApi\Client;

$client->listPlaylists()->limit(10)->get();
```

### Show subscription button

[](#show-subscription-button)

```
>

        @youtubeScriptButton()
       @youtubeButton()
