PHPackages                             hazel/ytdlphp - 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. [CLI &amp; Console](/categories/cli)
4. /
5. hazel/ytdlphp

ActiveLibrary[CLI &amp; Console](/categories/cli)

hazel/ytdlphp
=============

A typed PHP 8.5+ wrapper for the yt-dlp command-line tool

v1.0.1(yesterday)08↑2525%MITPHPPHP ^8.5

Since Jun 9Pushed yesterdayCompare

[ Source](https://github.com/hipsterjazzbo/ytdlphp)[ Packagist](https://packagist.org/packages/hazel/ytdlphp)[ RSS](/packages/hazel-ytdlphp/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (3)Used By (0)

ytdlphp
=======

[](#ytdlphp)

A typed PHP 8.5+ library for [yt-dlp](https://github.com/yt-dlp/yt-dlp).

Build command-line arguments with a fluent API, run yt-dlp via [Tempest Process](https://github.com/tempestphp/tempest-framework/tree/3.x/packages/process), and parse JSON metadata into typed objects. URLs are validated with PHP's built-in [URI extension](https://www.php.net/manual/en/book.uri.php) (WHATWG).

Requirements
------------

[](#requirements)

- PHP 8.5+
- Extensions: `json`, `uri`
- [yt-dlp](https://github.com/yt-dlp/yt-dlp) installed and available on `PATH` (or configured explicitly)

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

[](#installation)

```
composer require hazel/ytdlphp
```

Quick start
-----------

[](#quick-start)

```
use Ytdlphp\Options;
use Ytdlphp\YtDlp;

$ytDlp = new YtDlp();

$ytDlp->download(
    'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
    Options::create()
        ->format('bestvideo+bestaudio')
        ->output('%(title)s.%(ext)s'),
);

$info = $ytDlp->extractInfo('https://www.youtube.com/watch?v=dQw4w9WgXcQ');

echo $info->title;
echo $info->url?->toAsciiString();
```

Configuration
-------------

[](#configuration)

```
use Ytdlphp\Options;
use Ytdlphp\YtDlp;

$ytDlp = new YtDlp()
    ->withBinary('/usr/local/bin/yt-dlp')
    ->withWorkingDirectory('/tmp/downloads')
    ->withTimeout(300)
    ->withDefaultOptions(Options::create()->noWarnings());
```

Options builder
---------------

[](#options-builder)

`Options` provides typed methods for common yt-dlp flags, backed by enums where useful:

```
use Ytdlphp\Option\AudioFormat;
use Ytdlphp\Option\Browser;
use Ytdlphp\Options;

$options = Options::create()
    ->extractAudio()
    ->audioFormat(AudioFormat::Mp3)
    ->cookiesFromBrowser(Browser::Firefox)
    ->noPlaylist()
    ->merge($extraOptions);
```

Use `option()` for flags not covered by a dedicated method.

URLs
----

[](#urls)

Pass strings or `Uri\WhatWg\Url` instances. Strings are validated before yt-dlp runs:

```
use Uri\WhatWg\Url;
use Ytdlphp\UrlParser;

$url = UrlParser::parse('https://example.com/watch?v=abc');
$ytDlp->extractInfo($url);

$mediaUrls = $ytDlp->getUrls('https://example.com/watch?v=abc');
foreach ($mediaUrls as $mediaUrl) {
    echo $mediaUrl->toAsciiString();
}
```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

MIT. See [LICENSE](LICENSE).

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance100

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

1d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/231361?v=4)[Hazel Fidecaro](/maintainers/HipsterJazzbo)[@hipsterjazzbo](https://github.com/hipsterjazzbo)

---

Top Contributors

[![hipsterjazzbo](https://avatars.githubusercontent.com/u/231361?v=4)](https://github.com/hipsterjazzbo "hipsterjazzbo (2 commits)")

---

Tags

clivideoyoutubemediadownloadyt-dlpyoutube-dl

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hazel-ytdlphp/health.svg)

```
[![Health](https://phpackages.com/badges/hazel-ytdlphp/health.svg)](https://phpackages.com/packages/hazel-ytdlphp)
```

###  Alternatives

[symfony/console

Eases the creation of beautiful and testable command line interfaces

9.8k1.1B13.1k](/packages/symfony-console)[nunomaduro/collision

Cli error handling for console/command-line PHP applications.

4.6k348.7M10.3k](/packages/nunomaduro-collision)[nunomaduro/termwind

It's like Tailwind CSS, but for the console.

2.5k260.6M359](/packages/nunomaduro-termwind)[wp-cli/wp-cli

WP-CLI framework

5.1k18.5M386](/packages/wp-cli-wp-cli)[wp-cli/php-cli-tools

Console utilities for PHP

68327.0M372](/packages/wp-cli-php-cli-tools)[norkunas/youtube-dl-php

youtube-dl / yt-dlp wrapper for php

514343.0k16](/packages/norkunas-youtube-dl-php)

PHPackages © 2026

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