Install FFMPEG only if you want to convert videos to mp3 etc
Ubuntu:
sudo apt install ffmpegInstall via composer
composer require devswebdev/devtubeWhen you install it as a dependency, there need to be a cache directory beside vendor
and it should be writable (e.g. chmod 775).
Publish vendor assets
php artisan vendor:publish --provider="DevsWebDev\DevTube\DevTubeServiceProvider"An Example
namespace App\Http\Controllers;
use DevsWebDev\DevTube\Download;
class YoutubeDownloadController extends Controller
{
public function download(Request $r)
{
$dl = new Download($r->url, $format);
//Saves the file to specified directory
$dl->download();
// Return as a download
return response()->download($dl->savedPath);
}
}