PHP code example of bahaaalhagar / youtube-uploader

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

    

bahaaalhagar / youtube-uploader example snippets


'providers' => [
    ...
    BahaaAlhagar\YoutubeUploader\YoutubeUploaderServiceProvider::class,
],

'aliases' => [
    ...
    'YoutubeUploader' => BahaaAlhagar\YoutubeUploader\Facades\YoutubeUploader::class,
],

$video = YoutubeUploader::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 = YoutubeUploader::upload($fullPathToVideo, $params, 'unlisted');

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

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

return $youtube->getThumbnailUrl();

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

YoutubeUploader::delete($videoId);

$playlist = YoutubeUploader::createPlaylist($title, $description);

return $playlist->getPlaylistId();

$playlist = YoutubeUploader::createPlaylist($title, $description, 'unlisted');

YoutubeUploader::addVideoToPlaylist([
	'id' => 'jq498asd' // a youtube video id
], $playlistId);

YoutubeUploader::addVideoToPlaylist([
	'id' => 'jq498asd', // a youtube video id
	'title' => 'a new title for video in playlist'
], $playlistId);

$playlist = YoutubeUploader::createPlaylist($title, $description)->addVideoToPlaylist([
	'id' => 'jq498asd', // a youtube video id
]);

php artisan vendor:publish --provider="BahaaAlhagar\YoutubeUploader\YoutubeUploaderServiceProvider"