PHPackages                             drooz/youtube-to-mp3 - 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. drooz/youtube-to-mp3

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

drooz/youtube-to-mp3
====================

Convert and search youtube video's via your own API

14PHP

Since May 13Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Drooz/YoutubeMusicv2)[ Packagist](https://packagist.org/packages/drooz/youtube-to-mp3)[ RSS](/packages/drooz-youtube-to-mp3/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Youtube-to-mp3-API
==================

[](#youtube-to-mp3-api)

With these two php files you are able to create your own Youtube to MP3 API with ability to search also.

Possible HTTP requests
======================

[](#possible-http-requests)

- `GET - convert.php`

ParameterRequiredTypeDescriptionyoutubelinkYesstringThe full youtubelink of the video you want to downloaddeleteNostringThe youtubeid of which you want it to be deleted from storage on the server- `GET - search.php`

ParameterRequiredTypeDescriptionqYesstringThe query term to search for video'smax\_resultsNointegerThe max results of search results u want to getPossible HTTP responses
=======================

[](#possible-http-responses)

- `JSON - convert.php`

ParameterTypeDescriptionerrorbooleanWhether or not an error occuredmessagestringA simple message or the error messageParameterTypeDescriptionerrorbooleanfalsetitlestringThe title of the video that got converteddurationintegerThe duration of the video that got converted (in seconds)filestringThe streamlink or downloadable mp3 file- `JSON - search.php`

ParameterTypeDescriptionerrorbooleanWhether or not an error occuredmessagestringAn error messageresultsarrayAn array with MAX\_RESULTS entries. Each entry has: the video id, the channel name of the video, the video title and the full url to the videoSoftware requirements
=====================

[](#software-requirements)

- [youtube-dl](https://rg3.github.io/youtube-dl/)
- [ffmpeg](https://www.ffmpeg.org/) (+ [libmp3lame](http://lame.sourceforge.net/))

General installation
====================

[](#general-installation)

First we install the dependencies on the server, then website.

VPS
---

[](#vps)

- Install ffmpeg (+ libmp3lame - see below)
- [install youtube-dl](https://rg3.github.io/youtube-dl/download.html)

Website
-------

[](#website)

- Get a google developer api key
- Go to your webserver files to run composer into
- Run `composer create-project drooz/youtube-to-mp3 [directoryname]` - where `directoryname` is .. a directory where people can access the API from.
- Edit defines:

In `search.php` you can define these variables:

```
define("MAX_RESULTS", 10);
define("API_KEY", "");
```

How I installed ffmpeg (compiling/building and installing)
==========================================================

[](#how-i-installed-ffmpeg-compilingbuilding-and-installing)

If you have ffmpeg in `yum` or `apt-get` this is **not needed**. I had to do this manually as I'm using Centos 6.x

libmp3lame
----------

[](#libmp3lame)

First i had to install `libmp3lame` - ffmpeg uses this.

```
mkdir ffmpeg_sources && cd ffmpeg_sources
wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar xzvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure
make
make install
lame

```

ffmpeg
------

[](#ffmpeg)

Then ffmpeg; I work with Centos 6.x so the most updated ffmpeg is not available in `yum`

```
wget https://www.ffmpeg.org/releases/ffmpeg-3.3.2.tar.gz
tar xfz ffmpeg-3.3.2.tar.gz
cd ffmpeg-3.3.2
./configure --enable-libmp3lame --disable-yasm
make
make install

```

Aftwards ffmpeg was installed in `/usr/local/bin/ffmpeg` which then I needed to specify in `convert.php`

Example output
==============

[](#example-output)

Download/convert
----------------

[](#downloadconvert)

`http://michaelbelgium.me/ytconverter/convert.php?youtubelink=https://www.youtube.com/watch?v=gUJKs1m7Y8M`

```
{
	"error": false,
	"title": "Devin Wild & Sub Zero Project - Meltdown (Official Videoclip)",
	"duration": 210,
	"file": "http://michaelbelgium.me/ytconverter/download/gUJKs1m7Y8M.mp3"
}
```

Search
------

[](#search)

`http://michaelbelgium.me/ytconverter/search.php?q=belgium&max_results=5`

```
{
  "error": false,
  "message": null,
  "results": [
    {
      "channel": "FOOTBALL MINDS",
      "full_link": "https://youtube.com/watch?v=1Q6o3B5n_j4",
      "id": "1Q6o3B5n_j4",
      "title": "Belgium vs Japan 1-0 - Highlights & Goals - 14 November 2017"
    },
    {
      "channel": "Football Highlights & Goals",
      "full_link": "https://youtube.com/watch?v=v8DzbrQxXS8",
      "id": "v8DzbrQxXS8",
      "title": "BELGIUM vs MEXICO 3-3 ● All Goals & Highlights HD ● 10 Nov 2017 - FRIENDLY"
    },
    {
      "channel": "deielsio",
      "full_link": "https://youtube.com/watch?v=W3peC29XwOI",
      "id": "W3peC29XwOI",
      "title": "Lil Peep - Belgium [Unreleased]"
    },
    {
      "channel": "Geography Now",
      "full_link": "https://youtube.com/watch?v=0TuMvWCbM-g",
      "id": "0TuMvWCbM-g",
      "title": "Geography Now! Belgium"
    },
    {
      "channel": "Wolters World",
      "full_link": "https://youtube.com/watch?v=9SJiENN504M",
      "id": "9SJiENN504M",
      "title": "Visit Belgium - 5 Things You Will Love & Hate about Belgium"
    }
  ]
}
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/drooz-youtube-to-mp3/health.svg)

```
[![Health](https://phpackages.com/badges/drooz-youtube-to-mp3/health.svg)](https://phpackages.com/packages/drooz-youtube-to-mp3)
```

###  Alternatives

[m1/env

Env is a lightweight library bringing .env file parser compatibility to PHP. In short - it enables you to read .env files with PHP.

6412.0M21](/packages/m1-env)[roave/psalm-html-output

Psalm HTML Output

23312.0k1](/packages/roave-psalm-html-output)[pear/system_daemon

A port of the PEAR class to create Daemons with pure PHP

11139.9k1](/packages/pear-system-daemon)[mateffy/laravel-codebase-mcp

An MCP server to give Cursor, Aider, etc. the ability to introspect your Laravel codebase directly, by querying for your models, views, routes and classes without raw file search.

201.1k](/packages/mateffy-laravel-codebase-mcp)

PHPackages © 2026

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