Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Devtube Laravel Package

devswebdev/devtube

DevTube is a Laravel wrapper around the yt-dlp binary for downloading videos and extracting audio from any URL. Pass a link, pick a format like mp4 or mp3, and get back a collection of MediaFile objects. Requires PHP 8.3+, Laravel 12/13, and yt-dlp.

View on GitHub
Deep Wiki
Context7

DevTube is a Laravel package that downloads videos and extracts audio from any supported URL by wrapping the yt-dlp binary via norkunas/youtube-dl-php. It auto-registers a service provider and DevTube facade, and ships with a publishable config for binary path, download location, and per-format options.

  • Video downloads to configurable storage paths
  • Audio extraction (e.g. mp3) via ffmpeg
  • Format presets — mp4 and mp3 out of the box
  • Collection results of MediaFile objects with metadata
  • Requires PHP 8.3+ and Laravel 12/13
Frequently asked questions about Devtube
What Laravel versions does DevTube officially support?
DevTube is designed for Laravel 12 and 13. While it may work with older versions (e.g., 8/9), you’ll need to test route model binding and PHP 8.3+ features like named arguments. The package leverages Laravel’s service provider pattern for seamless integration.
How do I install yt-dlp and FFmpeg for DevTube?
Install yt-dlp via pip (`python3 -m pip install -U yt-dlp`) and FFmpeg (Ubuntu/Debian: `sudo apt install ffmpeg`). For macOS, use Homebrew (`brew install ffmpeg`). Verify paths in `config/devtube.php` or set them via `.env` (e.g., `DEVTUBE_YT_DLP_PATH`). FFmpeg is only required for audio extraction (MP3).
Can I customize download paths or file formats?
Yes. Configure `download_path` in `config/devtube.php` to set a storage directory (relative to `storage_path()`). Define formats like `mp4` or `mp3` in the `formats` array, specifying yt-dlp options such as `extract_audio` or `audio_quality`. The `output_template` key controls filenames (e.g., `%(title)s.%(ext)s`).
Does DevTube support async downloads to avoid blocking requests?
No, DevTube performs downloads synchronously by default. For high-traffic apps, queue downloads using Laravel Queues (e.g., Horizon or Sidekiq). Wrap the `download()` call in a job and dispatch it to a worker. Monitor CPU usage during FFmpeg transcoding for large files.
How do I handle errors if yt-dlp or FFmpeg fails?
DevTube doesn’t include built-in retry logic, so wrap calls in try-catch blocks to handle exceptions. For critical downloads, implement a fallback (e.g., manual review or a backup queue). Log failures to track recurring issues, especially with malformed URLs or unsupported platforms.
Is there a database table for tracking downloaded files?
No, DevTube stores files on disk only. Create a `media` table to log metadata (URL, format, user_id, status) and access logs (download_count). Example fields: `url`, `path`, `status` (pending/processed/failed), and timestamps. Use Laravel’s Filesystem for safe path handling.
Will DevTube work with YouTube Shorts or Live Streams?
DevTube relies on yt-dlp, which may not fully support emerging formats like YouTube Shorts or Live Streams. Test with your target URLs, as yt-dlp’s compatibility depends on its upstream updates. For unsupported formats, consider pre-processing URLs or using a wrapper library.
Are there alternatives to DevTube for Laravel video downloads?
Alternatives include custom solutions using the [yt-dlp PHP wrapper](https://github.com/norkunas/youtube-dl-php) directly or packages like `spatie/laravel-youtube`. However, DevTube offers a Laravel-native facade and centralized config, reducing boilerplate. Evaluate based on your need for async support or modern Laravel features.
How do I restrict downloads to specific domains (e.g., only YouTube)?
Use yt-dlp’s `--restrict-filenames` or `--ignore-no-formats` options in `config/devtube.php` under a custom format. For whitelisting, add a middleware to validate URLs before passing them to DevTube, or extend the `Download` class to filter domains.
Does DevTube support Laravel’s first-party testing tools (Pest, PHPUnit)?
Yes, DevTube can be tested with Laravel’s testing tools. Mock the `DevTube` facade or use HTTP tests to verify downloads. Test edge cases like invalid URLs or missing binaries by temporarily modifying `config/devtube.php` or using environment variables to override paths.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections