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
Youtube Downloader

Youtube Downloader Laravel Package

athlon1600/youtube-downloader

A pure PHP YouTube downloader with no JavaScript interpreters, shell calls, or heavy dependencies. Fetch video and audio stream links via a simple API, with built-in exception handling. Actively maintained.

View on GitHub
Deep Wiki
Context7

YouTube Downloader is a pure PHP library for extracting download links from YouTube videos—no JavaScript interpreters, shell calls, or heavy dependencies. Inspired by youtube-dl, it is actively maintained and installable via Composer: composer require athlon1600/youtube-downloader "^4.0". Call getDownloadLinks() on a YouTubeDownloader instance to receive a DownloadOptions object containing all available streams.

  • Pure PHP — no external binaries or shell execution
  • Audio-only and combined stream formats
  • Simple API — one method returns every download option
  • Exception handling via YouTubeException
  • Actively maintained with CI tests and PHP 7.4/8.0+ support
Frequently asked questions about Youtube Downloader
How do I install athlon1600/youtube-downloader in a Laravel app?
Install it with Composer using composer require athlon1600/youtube-downloader "^4.0". There is nothing else to publish or register, so you can immediately instantiate YouTubeDownloader and call getDownloadLinks() with a YouTube watch URL. Because the package has no Laravel glue, you typically wrap it in your own service class or interface and bind that in a service provider.
Which Laravel and PHP versions does this YouTube downloader support?
The package advertises PHP ^7.4 || ^8.0, which makes it installable on Laravel 8 through 11. On Laravel 10 and 11 the PHP floor is already 8.1 or higher, so the package's own floor is effectively moot on a current stack. Its dependency footprint is deliberately light, which keeps the risk of Composer conflicts with Laravel's dependency graph low.
Does this package require yt-dlp, ffmpeg, Python or a JavaScript runtime?
No. It is pure PHP with no shell calls, no exec(), no JavaScript interpreter and no Python or yt-dlp binary, which is its main architectural selling point compared with wrapping youtube-dl. It ships its own cURL-based HTTP layer instead of using Guzzle, so it does not depend on Illuminate\Http\Client either. The trade-off is that there is no ffmpeg-based merging, so you rely on the combined audio/video streams YouTube already exposes.
How do I get audio-only or combined audio/video links with getDownloadLinks()?
YouTubeDownloader::getDownloadLinks() returns a DownloadOptions object holding StreamFormat entries plus a VideoInfo object. getAllFormats() returns every stream, some audio-only and some combined audio/video, while helpers such as getCombinedFormats() and getFirstCombinedFormat() narrow the list for you. To serve audio-only downloads, filter getAllFormats() yourself for the audio streams you want to expose.
Is there a Laravel service provider or facade for this package?
No. The package ships no service provider, facade, config file or migrations, so installing it is not the same as integrating the feature. You own the container binding, configuration values and exception translation, which is typically a few hours of work. Wrapping the library behind your own interface also makes it swappable and mockable in tests.
How do I handle errors when getDownloadLinks() fails?
In version 4 the method throws YouTube\Exception\YouTubeException instead of returning an empty result, so wrap calls in try/catch and translate the exception into your application's own error type or HTTP response. Also check whether getAllFormats() is empty, since a successful parse can still yield no usable links. Log the original message so you can spot breakage caused by YouTube-side changes.
Can this package download private or age-restricted YouTube videos?
Private videos are not supported. Age-restricted content only works if you manually supply cookies exported from a browser session signed in to a real Google account. That makes it impractical for unattended multi-user applications, so treat restricted content as out of scope unless you can inject and refresh cookies yourself.
Will this work in production for high-volume downloading, and does it handle YouTube throttling?
The project's own To-Do list acknowledges throttling, with many videos served at under 100 kb/s, and there is no captcha or 429 mitigation built in. Returned googlevideo.com URLs are commonly bound to the requesting client's IP with short expiries, so handing a server-extracted URL to an end-user browser may fail. Verify that behaviour against your target formats before freezing your architecture, and plan your own rate limiting and retry policy.
How reliable is a pure-PHP YouTube downloader compared with yt-dlp, and what are the alternatives?
This library works by scraping and reverse-engineering YouTube's player JavaScript and signature/cipher scheme, so breakage is a steady state rather than an edge case, as the release history of cipher and endpoint fixes shows. It is effectively maintained by a single developer with no LTS branch, security disclosure process or commercial support, and major versions have introduced breaking changes. Alternatives are running a yt-dlp binary in a container, which brings back shell and patching overhead, or a third-party download API.
How do I test or mock YouTube downloads in Laravel without calling YouTube?
Because the package ships its own cURL Browser class rather than using Guzzle or Illuminate\Http\Client, Laravel's Http::fake() will not intercept its requests. Wrap YouTubeDownloader behind an interface you control and bind a fake implementation in your test suite instead. You can then unit test your service class against hand-built DownloadOptions and StreamFormat objects, keeping live YouTube calls out of CI.
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.
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log