PHP code example of michael / laravel-youtube

1. Go to this page and download the library: Download michael/laravel-youtube library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

michael / laravel-youtube example snippets


Laravel\Youtube\YoutubeServiceProvider::class

Youtube => Laravel\Youtube\Facades\Youtube::class

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

Copied File [/vendor/michael/laravel-youtube/config/youtube.php] To [/config/youtube.php]



$path = public_path().'/video/video.mp4';

$video = YouTube::uploadVideo($path, [
    'title'       => 'Laravel YouTube',
    'description' => 'Laravel YouTube',
    'tags'	  => ['laravel', 'laravel-youtube', 'php', 'package'],
    'category_id' => 10
], 'public');

return ["idVideo" => $video->getIdVideo(), "details" => $video->getSnippet()];



$id = "ID DO VIDEO";
$video = YouTube::updateVideo($id, [
    'title'       => 'Laravel YouTube',
    'description' => 'Laravel YouTube',
    'tags'	  => ['laravel', 'laravel-youtube', 'php', 'package'],
    'category_id' => 23
], 'public');

return $video->getDataUpdate();



$id = "O ID DO VIDEO";
$existVideo = YouTube::checkExistVideo($id);

return ['status' => $existVideo];



$id = "O ID DO VIDEO";
$existVideo = YouTube::getDetailsVideo($id);

return ["details" => $detailsVideo];



$id = "O ID DO VIDEO";
$video = YouTube::delete($id);

return ["excluir" => $video];



$result = YouTube::search('TERMO BUSCADO', 'MAXIMO DE RESULTADOS');

return ['lista' => $result];



YouTube::createEventRTMP("2019-05-13 22:00:00", "2019-05-13 23:00:00", "Evento teste");



YouTube::createEventRTMP("2019-05-13 22:00:00", "2019-05-13 23:00:00", "Evento teste", "unlisted", "Portuguese (Brazil)", "michael,laravel-youtube");



$video = YouTube::listEventsBroadcasts();

return ["list" => $video];
bash
php artisan migrate