Download the PHP package b7s/ytpilot without Composer
On this page you can find all versions of the php package b7s/ytpilot. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package ytpilot
Short Description A PHP backend wrapper for yt-dlp with automatic binary management and fluent API
License MIT
Informations about the package ytpilot
✨ Features
- 🎯 Fluent API - Laravel-inspired chainable interface
- 📦 Automatic Management - Downloads and manages yt-dlp, ffmpeg, and ffprobe automatically
- 🔍 Media Discovery - Query available formats, resolutions, codecs, and subtitles
- 🎬 Smart Presets - Cinema, mobile, and archive quality presets
- 🌍 Cross-Platform - Linux, macOS, and Windows support
- 🎯 Multi-Target - Download video, audio, subtitles, metadata, and thumbnails in one command
- 🔒 Type-Safe - Full PHP 8.3+ type hints and PHPStan level 6 compliant
- 🛠️ Complete CLI - Command-line tools for installation and diagnostics
📦 Installation
Install Binaries
After installing the package, install the required binaries:
This command will:
- ✅ Download the latest version of yt-dlp
- ✅ Download ffmpeg and ffprobe (if needed)
- ✅ Configure everything automatically
🚀 Quick Start
Simple Download
Extract Audio Only
Complete Download
🛠️ CLI Commands
install - Install Binaries
Automatically installs yt-dlp and ffmpeg:
Options:
--skip-ffmpeg- Skip ffmpeg installation--forceor-f- Force reinstallation even if already exists
Examples:
update - Update Binaries
Updates binaries to the latest versions:
Options:
--skip-ffmpeg- Skip ffmpeg update
Examples:
version - Check Versions
Displays YtPilot and installed binary versions:
Output:
doctor - Complete Diagnostics
Checks YtPilot installation and configuration:
What it checks:
- ✅ System information (OS, architecture, PHP)
- ✅ Binary status (installed, paths, source)
- ✅ Directory permissions
- ✅ Binary versions
- ✅ Current configuration
Example output:
📖 Examples
1. Query Available Formats
2. Use Quality Presets
🎬 Cinema (High Quality)
Perfect for large screens, prioritizes quality:
📱 Mobile (Reduced Size)
Perfect for mobile devices, prioritizes size:
🗄️ Archive (Maximum Quality)
Perfect for long-term archiving:
3. Download with Subtitles
4. Custom Format
5. Custom Output Directory
6. Handle Download Result
7. Use Custom Binaries
8. Custom Timeout
9. Using Cookies for Authenticated Content
Load cookies from file (Netscape format)
Extract cookies directly from browser
How to export cookies to Netscape format:
You can use browser extensions like:
- Chrome/Edge: Get cookies.txt LOCALLY
- Firefox: cookies.txt
Supported browsers: brave, chrome, chromium, edge, firefox, opera, safari, vivaldi, whale
10. Using Proxy for Downloads
Simple proxy configuration
Proxy with authentication
Using Tor for anonymous downloads
Geo-verification proxy
Use a different proxy only for geo-verification while downloading through your main connection:
Force IPv4 or IPv6
Bind to specific source address
Supported proxy protocols: http, https, socks4, socks4a, socks5, socks5h
Note:
socks5hresolves DNS through the proxy server, useful for accessing .onion sites through Tor.
🌐 Other Platforms
While YouTube is the primary focus, YtPilot supports downloading from many other platforms through yt-dlp. Just pass the URL and it works automatically for most platforms.
Supported Platforms
YtPilot supports 1000+ websites including:
Important: Only video/audio content is downloaded. Text posts, images, captions, and comments are not included.
| Platform | Example URL | Subtitles | Notes |
|---|---|---|---|
instagram.com/reel/... |
❌ | 🔒 Cookies recommended | |
| Twitter/X | twitter.com/user/status/... |
❌ | 🔓 Works without auth |
| TikTok | tiktok.com/@user/video/... |
❌ | 🔓 Works without auth |
facebook.com/watch?v=... |
⚠️ | 🔒 Cookies recommended | |
| Vimeo | vimeo.com/123456 |
✅ | 🔐 Password for private |
| Twitch | twitch.tv/videos/... |
✅ | VODs and clips |
reddit.com/r/.../comments/... |
❌ | 🔓 Works without auth | |
| SoundCloud | soundcloud.com/artist/track |
N/A | Audio only |
| Dailymotion | dailymotion.com/video/... |
✅ | 🔓 Works without auth |
| Bilibili | bilibili.com/video/... |
✅ | 🔐 Session for premium |
Basic Usage
For most platforms, just pass the URL:
Platform-Specific Configuration
Some platforms have optional configuration methods for advanced use cases:
Twitter/X API Selection
TikTok API Selection
Vimeo Password-Protected Videos
Bilibili Premium Content
Generic Authentication
For platforms requiring username/password:
Custom Extractor Arguments
For advanced use cases with any extractor:
Notes
- Cookies: Some platforms (Instagram, Facebook) require authentication via cookies
- Rate Limiting: Add delays between downloads if you experience issues
- Terms of Service: Respect each platform's terms when downloading content
- Subtitles: Only some platforms support subtitles (YouTube, Vimeo, Twitch, Dailymotion, Bilibili). Social media platforms like Instagram, Twitter, TikTok, and Reddit typically don't have subtitle support
Target Methods (Accumulative)
Define what will be downloaded. Can be combined:
| Method | Description |
|---|---|
video() |
Download video |
audio() |
Download audio |
subtitles() |
Download manual subtitles |
autoSubtitles() |
Download automatic subtitles |
metadata() |
Download JSON metadata |
thumbnail() |
Download thumbnail |
Format Methods (Chainable)
Control how the download will be performed:
Format Selection
| Method | Description | Example |
|---|---|---|
format(string) |
Custom selector | ->format('bestvideo+bestaudio') |
best() |
Best quality | ->best() |
worst() |
Worst quality | ->worst() |
resolution(string) |
Specific resolution | ->resolution('1080p') |
fps(int) |
Maximum FPS | ->fps(60) |
videoCodec(string) |
Video codec | ->videoCodec('av01') |
audioCodec(string) |
Audio codec | ->audioCodec('opus') |
container(string) |
Container format | ->container('mp4') |
hdr() |
HDR content | ->hdr() |
sdr() |
SDR content | ->sdr() |
Smart Presets
| Method | Description | Format |
|---|---|---|
cinema() |
High quality for large screens | 1080p+, AV1/VP9/AVC |
mobile() |
Reduced size for mobile | 720p max, AVC, 128k |
archive() |
Maximum quality for archiving | AV1/VP9 preferred |
Audio Options
| Method | Description | Example |
|---|---|---|
audioOnly() |
Extract audio only | ->audioOnly() |
audioFormat(string) |
Audio format | ->audioFormat('mp3') |
audioQuality(string) |
Audio quality | ->audioQuality('320K') |
Subtitle Options
| Method | Description | Example |
|---|---|---|
subtitleLanguages(array) |
Subtitle languages | ->subtitleLanguages(['en', 'es']) |
subtitleFormat(string) |
Subtitle format (custom) | ->subtitleFormat('srt') |
subtitleAsSrt() |
Subtitle as SRT format | ->subtitleAsSrt() |
subtitleAsVtt() |
Subtitle as WebVTT format | ->subtitleAsVtt() |
subtitleAsAss() |
Subtitle as ASS format | ->subtitleAsAss() |
subtitleAsSsa() |
Subtitle as SSA format | ->subtitleAsSsa() |
subtitleAsLrc() |
Subtitle as LRC format | ->subtitleAsLrc() |
subtitleAsTtml() |
Subtitle as TTML format | ->subtitleAsTtml() |
subtitleAsJson3() |
Subtitle as JSON3 format | ->subtitleAsJson3() |
Output Options
| Method | Description | Example |
|---|---|---|
output(string) |
Filename template | ->output('%(title)s.%(ext)s') |
outputPath(string) |
Output directory | ->outputPath('./downloads') |
overwrite() |
Overwrite existing files | ->overwrite() |
skipDownload() |
Skip actual download | ->skipDownload() |
simulate() |
Simulate download | ->simulate() |
Note: If no
outputPath()is specified, files are downloaded to the current working directory or the path defined inconfig/ytpilot.phpunderdownload_path.
Cookie Options
| Method | Description | Example |
|---|---|---|
cookies(string) |
Load cookies from Netscape file | ->cookies('/path/to/cookies.txt') |
cookiesFromBrowser(string, ?string, ?string) |
Extract cookies from browser | ->cookiesFromBrowser('chrome') |
noCookies() |
Explicitly disable cookies | ->noCookies() |
Supported browsers: brave, chrome, chromium, edge, firefox, opera, safari, vivaldi, whale
Cookie use cases:
- Access age-restricted content
- Download private/unlisted videos (with authenticated account)
- Access premium content (YouTube Premium, etc.)
- Bypass censorship/geo-restrictions
Proxy & Network Options
| Method | Description | Example |
|---|---|---|
proxy(string) |
Set proxy URL (any protocol) | ->proxy('http://proxy:8080') |
proxyWithAuth(string, int, string, string, ProxyProtocol) |
Proxy with authentication | ->proxyWithAuth('host', 8080, 'user', 'pass') |
httpProxy(string, int) |
HTTP proxy | ->httpProxy('proxy.example.com', 8080) |
httpsProxy(string, int) |
HTTPS proxy | ->httpsProxy('proxy.example.com', 443) |
socks4Proxy(string, int) |
SOCKS4 proxy | ->socks4Proxy('proxy.example.com', 1080) |
socks5Proxy(string, int) |
SOCKS5 proxy | ->socks5Proxy('proxy.example.com', 1080) |
socks5hProxy(string, int) |
SOCKS5 with remote DNS resolution | ->socks5hProxy('proxy.example.com', 1080) |
torProxy(int) |
Tor proxy (default port 9050) | ->torProxy() or ->torProxy(9150) |
noProxy() |
Explicitly disable proxy | ->noProxy() |
geoVerificationProxy(string) |
Proxy for geo-verification only | ->geoVerificationProxy('http://geo-proxy:8080') |
sourceAddress(string) |
Bind to specific IP address | ->sourceAddress('192.168.1.100') |
forceIpv4() |
Force IPv4 connections | ->forceIpv4() |
forceIpv6() |
Force IPv6 connections | ->forceIpv6() |
Supported proxy protocols: http, https, socks4, socks4a, socks5, socks5h
Proxy use cases:
- Bypass censorship/geo-restrictions
- Avoid IP bans and rate limiting
- Access content from specific regions
- Route traffic through Tor for anonymity
Platform Configuration
| Method | Description | Example |
|---|---|---|
configTwitter(TwitterApi) |
Configure Twitter API | ->configTwitter(TwitterApi::Syndication) |
configTikTok(TikTokApi) |
Configure TikTok API | ->configTikTok(TikTokApi::Web) |
configVimeo(string) |
Vimeo password-protected | ->configVimeo('password') |
configBilibili(string) |
Bilibili session data | ->configBilibili('sess_data') |
withCredentials(string, string) |
Set username/password | ->withCredentials('user', 'pass') |
extractorArgs(string, array) |
Custom extractor arguments | ->extractorArgs('youtube', [...]) |
Binary Management
| Method | Description | Example |
|---|---|---|
ensureInstalled() |
Ensure binaries installed (auto-called) | ->ensureInstalled() |
withYtDlpPath(string) |
Custom yt-dlp path | ->withYtDlpPath('/usr/bin/yt-dlp') |
withFfmpegPath(string) |
Custom ffmpeg path | ->withFfmpegPath('/usr/bin/ffmpeg') |
withFfprobePath(string) |
Custom ffprobe path | ->withFfprobePath('/usr/bin/ffprobe') |
timeout(int) |
Timeout in seconds | ->timeout(300) |
Note:
ensureInstalled()is automatically called when usingYtPilot::make(), so you don't need to call it manually unless you want to force a re-check.
Query Methods (Non-Chainable)
Execute immediately and return data:
| Method | Return | Description |
|---|---|---|
getAvailableFormats() |
FormatItem[] |
All available formats |
getAvailableResolutions() |
string[] |
Available resolutions |
getAvailableFrameRates() |
int[] |
Available FPS |
getAvailableVideoCodecs() |
string[] |
Video codecs |
getAvailableAudioCodecs() |
string[] |
Audio codecs |
getAvailableContainers() |
string[] |
Container formats |
getAvailableDynamicRanges() |
string[] |
Dynamic ranges (HDR/SDR) |
getAvailableSubtitles() |
SubtitleList |
Available subtitles |
Execution Method
| Method | Return | Description |
|---|---|---|
download() |
DownloadResult |
Execute the download |
📊 Progress Callbacks
Track download and conversion progress in real-time:
Download Progress
Conversion Progress
Callback Parameters:
$percentage- Progress percentage (0-100)$downloaded/$current- Current bytes/seconds processed$total/$duration- Total bytes/seconds to process
🔄 Video & Audio Conversion
Convert media files between formats using the project's ffmpeg binary. All conversion methods now support smart defaults for seamless workflow integration.
Video Conversion Methods
| Method | Description |
|---|---|
convertVideoTo(?string $input, ?string $output, string $format, bool $deleteOriginal) |
Convert to custom format |
convertVideoToMp4(?string $input, ?string $output, bool $deleteOriginal) |
Convert to MP4 (H.264/AAC) |
convertVideoToMkv(?string $input, ?string $output, bool $deleteOriginal) |
Convert to MKV (copy) |
convertVideoToWebm(?string $input, ?string $output, bool $deleteOriginal) |
Convert to WebM (VP9/Opus) |
convertVideoToAvi(?string $input, ?string $output, bool $deleteOriginal) |
Convert to AVI (H.264/MP3) |
Audio Conversion Methods
| Method | Description |
|---|---|
convertAudioTo(?string $input, ?string $output, string $format, bool $deleteOriginal) |
Convert to custom format |
convertAudioToMp3(?string $input, ?string $output, bool $deleteOriginal) |
Convert to MP3 (320kbps) |
convertAudioToM4a(?string $input, ?string $output, bool $deleteOriginal) |
Convert to M4A (AAC 192k) |
convertAudioToOpus(?string $input, ?string $output, bool $deleteOriginal) |
Convert to Opus (128kbps) |
convertAudioToOgg(?string $input, ?string $output, bool $deleteOriginal) |
Convert to Ogg Vorbis |
convertAudioToWav(?string $input, ?string $output, bool $deleteOriginal) |
Convert to WAV (PCM) |
convertAudioToFlac(?string $input, ?string $output, bool $deleteOriginal) |
Convert to FLAC (lossless) |
Smart Conversion Features
All parameters are optional with intelligent defaults:
$input- Ifnull, uses the last downloaded video/audio file automatically$output- Ifnull, saves to the same directory with the correct extension$deleteOriginal- Defaulttrue, automatically removes the original file after successful conversion
Conversion Examples
1. Download and convert (simplest way):
2. Download and convert (keep original):
3. Download with custom output path:
4. Convert existing files (explicit input):
5. Custom format with progress tracking:
6. Batch conversion workflow:
⚙️ Configuration
Create a config/ytpilot.php file:
Download Location
By default, files are downloaded to the current working directory (where your PHP script is executed).
You can change this in three ways:
-
Set in configuration file:
-
Set per download:
- Set custom filename template:
🔍 Binary Resolution Priority
For all binaries (yt-dlp, ffmpeg, ffprobe), the resolution order is:
- ✅ Runtime override via fluent API (
withYtDlpPath(), etc.) - ✅ Path defined in configuration file
- ✅ System PATH (if
prefer_global = true) - ✅ Automatic download to local directory
- ❌ Exception if all options fail
📋 Requirements
- PHP 8.3 or higher
- Composer
- Internet connection
- PHP Extensions:
curlorallow_url_fopen(for downloads)zip(for ffmpeg extraction on Windows/macOS)
🤝 Contributing
Contributions are welcome! Feel free to:
- 🐛 Report bugs
- 💡 Suggest new features
- 🔧 Submit pull requests
- 📖 Improve documentation
📄 License
This project is licensed under the MIT License.
🙏 Credits
- Built on top of yt-dlp
- Uses Symfony Process
- Uses Symfony Console