PHPackages                             chasegiunta/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. chasegiunta/youtube-downloader

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

chasegiunta/youtube-downloader
==============================

PHP powered alternative for youtube-dl

3.1(3y ago)098MITPHPPHP ^5.6 || ^7.0 || ^8.0

Since Jan 13Pushed 3y agoCompare

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

READMEChangelog (1)Dependencies (2)Versions (2)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?...');
```

- Pass in your own cookies/user-agent

If you try downloading age-restricted videos, YouTube will ask you to login. The only way to make this work, is to login to your YouTube account in your own web-browser, export those newly set cookies from your browser into a file, and then pass it all to youtube-downloader for use.

```
$youtube = new YouTubeDownloader();
$youtube->getBrowser()->setCookieFile('./your_cookies.txt');
$youtube->getBrowser()->setUserAgent('Opera 7.6');
```

See also:

- Before you continue to YouTube...

Depending on your region, you might be force redirected to a [page](https://unblockvideos.com/images/before-you-continue-cookies.jpg) that asks you to agree to Google's cookie policy. You can programmatically agree to those terms, and bypass that warning permanently via `consentCookies` method on your Browser instance. Example:

```
$youtube = new YouTubeDownloader();
$youtube->getBrowser()->consentCookies();
```

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)

- Allow downloading of private videos.
- Find a way to get around YouTube's throttling system that limits downloading speed to less than 100 kb/s for most most videos now...
- 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

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.1% 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

Unknown

Total

1

Last Release

1214d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fddff4e56b10437114fa7021297e8df81a895cd70c3c15bd96e977223d3f3a14?d=identicon)[chasegiunta](/maintainers/chasegiunta)

---

Top Contributors

[![Athlon1600](https://avatars.githubusercontent.com/u/1063088?v=4)](https://github.com/Athlon1600 "Athlon1600 (117 commits)")[![volkirik](https://avatars.githubusercontent.com/u/33526598?v=4)](https://github.com/volkirik "volkirik (3 commits)")[![chasegiunta](https://avatars.githubusercontent.com/u/1377169?v=4)](https://github.com/chasegiunta "chasegiunta (2 commits)")[![shivampaw](https://avatars.githubusercontent.com/u/11842979?v=4)](https://github.com/shivampaw "shivampaw (1 commits)")[![Thorsten7701](https://avatars.githubusercontent.com/u/21060848?v=4)](https://github.com/Thorsten7701 "Thorsten7701 (1 commits)")[![xafable](https://avatars.githubusercontent.com/u/74095623?v=4)](https://github.com/xafable "xafable (1 commits)")[![codezi](https://avatars.githubusercontent.com/u/19167750?v=4)](https://github.com/codezi "codezi (1 commits)")[![Ibrram](https://avatars.githubusercontent.com/u/29353848?v=4)](https://github.com/Ibrram "Ibrram (1 commits)")

---

Tags

youtube downloaderdownload youtubedownload youtube videos

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[athlon1600/youtube-downloader

PHP powered alternative for youtube-dl

922160.2k9](/packages/athlon1600-youtube-downloader)[pingpong/oembed

Laravel 4 - Retrieve page info using oembed, opengraph, etc.

142.1k](/packages/pingpong-oembed)

PHPackages © 2026

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