PHPackages                             spartaksun/youtube-downloader - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. spartaksun/youtube-downloader

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

spartaksun/youtube-downloader
=============================

PHP powered alternative for youtube-dl

v3.0.3(4y ago)085MITPHPPHP ^5.6 || ^7.0 || ^8.0

Since Dec 27Pushed 4y agoCompare

[ Source](https://github.com/spartaksun/youtube-downloader)[ Packagist](https://packagist.org/packages/spartaksun/youtube-downloader)[ RSS](/packages/spartaksun-youtube-downloader/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (2)Versions (21)Used By (0)

[![](https://camo.githubusercontent.com/21265cb3d9ccad1e59a6c13127e09d2f026d385633be796f58c9d69c1abb21fd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f4174686c6f6e313630302f796f75747562652d646f776e6c6f616465722e737667)](https://camo.githubusercontent.com/21265cb3d9ccad1e59a6c13127e09d2f026d385633be796f58c9d69c1abb21fd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f4174686c6f6e313630302f796f75747562652d646f776e6c6f616465722e737667) [![](https://camo.githubusercontent.com/2b5717d3d02c9f731abcd813f725ce61fc82b93417b3b2d50fa750fa7c3482e9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f4174686c6f6e313630302f796f75747562652d646f776e6c6f616465722e737667)](https://camo.githubusercontent.com/2b5717d3d02c9f731abcd813f725ce61fc82b93417b3b2d50fa750fa7c3482e9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f4174686c6f6e313630302f796f75747562652d646f776e6c6f616465722e737667) [![](https://camo.githubusercontent.com/e3039c323381d317924e28c419a9b34a0daa55928c82a0cbf2c326472941d5c3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4174686c6f6e313630302f796f75747562652d646f776e6c6f616465722e737667)](https://camo.githubusercontent.com/e3039c323381d317924e28c419a9b34a0daa55928c82a0cbf2c326472941d5c3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4174686c6f6e313630302f796f75747562652d646f776e6c6f616465722e737667)

youtube-downloader
==================

[](#youtube-downloader)

This project was inspired by a very popular youtube-dl python package:

Yes, there are multiple other PHP-based youtube downloaders on the Internet, but most of them haven't been updated in years, or they depend on youtube-dl itself.

Pure PHP-based youtube downloaders that work, and are **kept-up-to date** just do not exist.

This script uses no Javascript interpreters, no calls to shell... nothing but pure PHP with no heavy dependencies either.

[![](https://camo.githubusercontent.com/e8b74ff521de5b53c7f19390d50d271e7518898f342048e46bd608a53b70d693/68747470733a2f2f692e696d6775722e636f6d2f33394c494530722e706e67)](https://camo.githubusercontent.com/e8b74ff521de5b53c7f19390d50d271e7518898f342048e46bd608a53b70d693/68747470733a2f2f692e696d6775722e636f6d2f33394c494530722e706e67)

That's all there is to it!

⚠️ Legal Disclaimer
-------------------

[](#warning-legal-disclaimer)

This program is for personal use only. Downloading copyrighted material without permission is against [YouTube's terms of services](https://www.youtube.com/static?template=terms). By using this program, you are solely responsible for any copyright violations. We are not responsible for people who attempt to use this program in any way that breaks YouTube's terms of services.

Demo App
--------

[](#demo-app)

This may not work at all times, because YouTube puts a short ban on the server if it receives too many requests from it.

-

[![](https://camo.githubusercontent.com/04c886fd212f7defbcb07e59ad33d5ae862af122afbb3c49d6d717495e5ffbed/687474703a2f2f70726f78796e6f76612e73332e75732d656173742d312e616d617a6f6e6177732e636f6d2f796f75747562652d646f776e6c6f616465722d736176652d766964656f2e706e67)](https://camo.githubusercontent.com/04c886fd212f7defbcb07e59ad33d5ae862af122afbb3c49d6d717495e5ffbed/687474703a2f2f70726f78796e6f76612e73332e75732d656173742d312e616d617a6f6e6177732e636f6d2f796f75747562652d646f776e6c6f616465722d736176652d766964656f2e706e67)

### Deploy your own App

[](#deploy-your-own-app)

on Heroku:

[![Deploy](https://camo.githubusercontent.com/4eea217b02568cc464752586784ae247b22e99fea520a15b6f919b15934ba8ca/68747470733a2f2f7777772e6865726f6b7563646e2e636f6d2f6465706c6f792f627574746f6e2e737667)](https://heroku.com/deploy)

Create a FREE account first if you do not yet have one:

Installation
------------

[](#installation)

Recommended way of installing this is via [Composer](http://getcomposer.org):

```
composer require athlon1600/youtube-downloader "^3.0"
```

Run locally:

```
php -S localhost:8000 -t vendor/athlon1600/youtube-downloader/public
```

Previous versions
=================

[](#previous-versions)

Instructions for installing &amp; using Version 2 can be found here:

Usage
=====

[](#usage)

```
use YouTube\YouTubeDownloader;
use YouTube\Exception\YouTubeException;

$youtube = new YouTubeDownloader();

try {
    $downloadOptions = $youtube->getDownloadLinks("https://www.youtube.com/watch?v=aqz-KE-bpKQ");

    if ($downloadOptions->getAllFormats()) {
        echo $downloadOptions->getFirstCombinedFormat()->url;
    } else {
        echo 'No links found';
    }

} catch (YouTubeException $e) {
    echo 'Something went wrong: ' . $e->getMessage();
}
```

`getDownloadLinks` method returns a `DownloadOptions` type object, which holds an array of stream links - some that are audio-only, and some that are both audio and video combined into one.

For typical usage, you are probably interested in dealing with combined streams, for that case, there is the `getCombinedFormats` method.

Other Features
--------------

[](#other-features)

- Stream YouTube videos directly from your server:

```
$youtube = new \YouTube\YouTubeStreamer();
$youtube->stream('https://r4---sn-n4v7knll.googlevideo.com/videoplayback?...');
```

How does it work
----------------

[](#how-does-it-work)

A more detailed explanation on how to download videos from YouTube will be written soon. For now, there is this:

[Athlon1600#25 (comment)](https://github.com/Athlon1600/youtube-downloader/pull/25#issuecomment-439373506)

Other Links
-----------

[](#other-links)

-
-
- [https://github.com/ytdl-org/youtube-dl/blob/master/youtube\_dl/extractor/youtube.py](https://github.com/ytdl-org/youtube-dl/blob/master/youtube_dl/extractor/youtube.py)

To-do list
----------

[](#to-do-list)

- Add ability to solve YouTube Captcha and avoid `HTTP 429 Too Many Requests` errors.
- Add ability to download video and audio streams separately, and merge the two together using ffmpeg. Just like `youtube-dl` does!
- Optional command that finds ALL video formats.
- Fetch additional metadata about the video without using YouTube API.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 91.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~87 days

Recently: every ~33 days

Total

20

Last Release

1764d ago

Major Versions

v1.0.1 → v2.0.02019-12-31

v2.1.1 → v3.0.02021-02-27

v2.1.2 → v3.0.12021-05-24

PHP version history (2 changes)v2.0.4PHP ^5.6 || ^7.0

v3.0.2PHP ^5.6 || ^7.0 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/065df9e5ff6cedd80cf8a49ca639578e8b9386b40841a1f11c5c63468620d4e0?d=identicon)[spartaksun](/maintainers/spartaksun)

---

Top Contributors

[![Athlon1600](https://avatars.githubusercontent.com/u/1063088?v=4)](https://github.com/Athlon1600 "Athlon1600 (90 commits)")[![spartaksun](https://avatars.githubusercontent.com/u/6684190?v=4)](https://github.com/spartaksun "spartaksun (3 commits)")[![volkirik](https://avatars.githubusercontent.com/u/33526598?v=4)](https://github.com/volkirik "volkirik (3 commits)")[![codezi](https://avatars.githubusercontent.com/u/19167750?v=4)](https://github.com/codezi "codezi (1 commits)")[![Thorsten7701](https://avatars.githubusercontent.com/u/21060848?v=4)](https://github.com/Thorsten7701 "Thorsten7701 (1 commits)")

---

Tags

youtube downloaderdownload youtubedownload youtube videos

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/spartaksun-youtube-downloader/health.svg)

```
[![Health](https://phpackages.com/badges/spartaksun-youtube-downloader/health.svg)](https://phpackages.com/packages/spartaksun-youtube-downloader)
```

###  Alternatives

[athlon1600/youtube-downloader

PHP powered alternative for youtube-dl

922160.2k9](/packages/athlon1600-youtube-downloader)[umpirsky/currency-list

List of all currencies with names and ISO 4217 codes in all languages and all data formats.

326325.2k10](/packages/umpirsky-currency-list)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
