A Laravel package for downloading videos from the net by simply passing a URL
burakerenel/devtube is a Laravel package for a laravel package for downloading videos from the net by simply passing a url.
It currently has 0 GitHub stars and 6 downloads on Packagist (latest version 2.0.6).
Install it with composer require burakerenel/devtube.
Discover more Laravel packages by burakerenel
or browse all Laravel packages to compare alternatives.
Last updated

Install FFMPEG only if you want to convert videos to mp3 etc
Ubuntu:
sudo apt install ffmpeg
Install youtube-dl
sudo apt install youtube-dl
Install via composer
composer require devswebdev/devtube
Publish vendor assets
php artisan vendor:publish --provider="DevsWebDev\DevTube\DevTubeServiceProvider"
This publishes a devtube.php file in your config/ directory
Please set your default options there.
Make sure your youtube-dl path is correct by comparing the output of which youtube-dl to the bin_path in devtube.php
"bin_path" => "/usr/bin/youtube-dl",
An Example
namespace App\Http\Controllers;
use DevsWebDev\DevTube\Download;
class YoutubeDownloadController extends Controller
{
public function download()
{
$dl = new Download($url = "https://www.youtube.com/watch?v=ye5BuYf8q4o", $format = "mp4", $download_path = "music" );
//Saves the file to specified directory
$media_info = $dl->download();
$media_info = $media_info->first();
// Return as a download
return response()->download($media_info['file']->getPathname());
}
}
Or in your web.php routes file
use DevsWebDev\DevTube\Download;
Route::get('/', function () {
$dl = new Download($url = "https://www.youtube.com/watch?v=ye5BuYf8q4o", $format = "mp3", $download_path = "music" );
//Saves the file to specified directory
$media_info = $dl->download();
$media_info = $media_info->first();
// Return as a download
return response()->download($media_info['file']->getPathname());
});