PHP code example of dawson / youtube

1. Go to this page and download the library: Download dawson/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/ */

    

dawson / youtube example snippets


'providers' => [
    ...
    Dawson\Youtube\YoutubeServiceProvider::class,
],

'aliases' => [
    ...
    'Youtube' => Dawson\Youtube\Facades\Youtube::class,
],

$video = Youtube::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();

$video = Youtube::upload($fullPathToVideo, $params, 'unlisted');

$fullpathToImage = storage_path('app/public/thumbnail.jpg');

$video = Youtube::upload($fullPathToVideo, $params)->withThumbnail($fullpathToImage);

return $youtube->getThumbnailUrl();

$video = Youtube::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();

Youtube::delete($videoId);

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