Download the PHP package darkwob/youtube-mp3-converter without Composer
On this page you can find all versions of the php package darkwob/youtube-mp3-converter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download darkwob/youtube-mp3-converter
More information about darkwob/youtube-mp3-converter
Files in darkwob/youtube-mp3-converter
Package youtube-mp3-converter
Short Description A powerful YouTube to MP3 converter with playlist support, progress tracking, and advanced features
License MIT
Homepage https://github.com/darkwob/youtube-mp3-converter
Informations about the package youtube-mp3-converter
🎵 YouTube to MP3 Converter
A powerful and feature-rich YouTube to MP3 converter library for PHP 8.3+ that supports YouTube video conversion with extensive customization options, progress tracking, and Windows compatibility with enhanced binary management.
✨ Key Features
- 🎵 Convert YouTube videos to multiple audio formats (MP3, AAC, FLAC, WAV, etc.)
- 📋 Full playlist support - Convert entire playlists or specific items
- 🎯 Smart URL detection - Automatically handles single videos and playlists
- 🎶 YouTube Music support - Works with YouTube Music URLs
- 📊 Real-time progress tracking (File-based or Redis)
- 🌐 Remote server conversion support
- 🔒 Clean and modern PHP 8.3+ API with readonly properties
- 🛠️ Extensive configuration options (quality, metadata, thumbnails)
- 🎯 ConversionResult objects for type-safe results
- 🔄 Cross-platform compatibility (Windows, Linux, macOS)
- 🚀 Robust error handling with specific exception types
- 🪟 Enhanced Windows support with path normalization
- 🔧 Intelligent binary detection and management
- 📁 Advanced directory and process management
🚀 Installation
Requirements
- PHP >= 8.3 (required)
- JSON extension
- FFmpeg (required for audio conversion)
- yt-dlp (required for video downloading)
- Redis (optional, for Redis-based progress tracking)
- Windows: Proper PATH environment or binary placement in project directory
💻 Basic Usage
Simple Video Conversion
Playlist Conversion
Smart URL Processing
Advanced Configuration
Remote Conversion
Progress Tracking with Redis
🔧 API Reference
YouTubeConverter Class
Main class for video conversion operations.
Methods
processVideo(string $url): ConversionResult
- Convert single videoprocessPlaylist(string $playlistUrl): array
- Convert YouTube playlistgetVideoInfo(string $url): array
- Get video metadatagetPlaylistInfo(string $playlistUrl): array
- Get playlist metadataisPlaylistUrl(string $url): bool
- Check if URL is a playlistextractVideoId(string $url): string
- Extract video ID from URLextractPlaylistId(string $url): string
- Extract playlist ID from URLdownloadVideo(string $url, string $id): string
- Download video file (internal)
ConversionResult Class
Readonly result object returned by processVideo()
:
getOutputPath(): string
- Full path to converted filegetTitle(): string
- Video titlegetVideoId(): string
- Internal process IDgetFormat(): string
- Audio format (mp3, aac, etc.)getSize(): int
- File size in bytesgetDuration(): float
- Duration in secondstoArray(): array
- Convert to array
ConverterOptions Class
Configuration options for the converter.
Methods
setAudioFormat(string $format): self
- Set output audio formatsetAudioQuality(int $quality): self
- Set audio quality (0-9)setPlaylistItems(string $items): self
- Set playlist items to processsetDateAfter(string $date): self
- Set start date filter (YYYYMMDD)setDateBefore(string $date): self
- Set end date filter (YYYYMMDD)setFileSizeLimit(string $limit): self
- Set maximum file sizesetOutputTemplate(string $template): self
- Set output filename templatesetProxy(string $proxy): self
- Set proxy serversetRateLimit(int $limit): self
- Set download speed limit (KB/s)enableThumbnail(bool $enable): self
- Enable thumbnail embeddingsetMetadata(array $metadata): self
- Set audio metadata
RemoteConverter Class
Handle remote conversion operations.
Methods
processVideo(string $url): ConversionResult
- Process video on remote servergetVideoInfo(string $url): array
- Get video info from remote serverdownloadVideo(string $url, string $id): string
- Download from remote server
Progress Tracking
Both FileProgress
and RedisProgress
implement ProgressInterface
:
Methods
update(string $id, string $status, float $progress, string $message): void
get(string $id): ?array
remove(string $id): void
🛠️ Error Handling
The package uses specific exception types for better error handling:
🔒 Security
- Input validation and URL sanitization
- Safe file handling with proper permissions
- Proxy support for restricted networks
- Cross-platform path handling with Windows normalization
- Secure temporary file management with automatic cleanup
- Binary path validation and security checks
- Windows environment variable handling
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📚 Documentation
For more detailed documentation and examples, visit our Wiki.
⚠️ Disclaimer
This package is for educational purposes only. Please respect YouTube's terms of service and copyright laws when using this package.
All versions of youtube-mp3-converter with dependencies
symfony/process Version ^5.4|^6.0|^7.0
guzzlehttp/guzzle Version ^7.0
ext-json Version *