PHPackages                             kolbasyatin/php-mpd-client - 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. kolbasyatin/php-mpd-client

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

kolbasyatin/php-mpd-client
==========================

Light MPD client

1.2.1(4y ago)63252[1 PRs](https://github.com/Kolbasyatin/php-mpd-client/pulls)MITPHPPHP ^7.3 || ^8.0CI passing

Since Nov 28Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/Kolbasyatin/php-mpd-client)[ Packagist](https://packagist.org/packages/kolbasyatin/php-mpd-client)[ Docs](http://mds.planeset.ru)[ RSS](/packages/kolbasyatin-php-mpd-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (10)Used By (0)

[![Build Status](https://camo.githubusercontent.com/57c01d535f54fc8cbdcc1aa208e8c4daf7a5c278802d2a762d7ca02055d72dec/68747470733a2f2f7472617669732d63692e636f6d2f4b6f6c626173796174696e2f5048502d4d50442d434c49454e542e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/Kolbasyatin/PHP-MPD-CLIENT)

PHP-MPD-CLIENT
--------------

[](#php-mpd-client)

---

### What is it?

[](#what-is-it)

This is a simple php written [mpd](https://www.musicpd.org/) client library.

##### How to install

[](#how-to-install)

---

`composer require kolbasyatin/php-mpd-client`

##### How to use

[](#how-to-use)

---

###### Usage

[](#usage)

```
use Kolbasyatin\MPD\MPD\MPDClient;
use Kolbasyatin\MPD\MPD\MPDConnection;

$connection = new MPDConnection('localhost:6600', 'yourpassword');
$client = new MPDClient($connection);

$client->play(); // Send the command
$answer = $client->status(); // Get the result
```

The answer is array in example above.

---

You may add an answer with custom format by adding the object instance which implements `MPDAnswerInterface` to `MPDClient` constructor . There is one simple Answer yet.

```
use Kolbasyatin\MPD\MPD\MPDClient;
use Kolbasyatin\MPD\MPD\MPDConnection;
use Kolbasyatin\MPD\MPD\Answers\SimpleAnswer;

$connection = new MPDConnection('localhost:6600', 'yourpassword');
$answer = new SimpleAnswer();
$client = new MPDClient($connection, $answer);

$client->play();

/** @var SimpleAnswer $answer */
$answer = $client->status(); // $answer is instance of SimpleAnswer.
$answer->getAnswerAsRaw(); // You also can get a raw answer from a server.
$answer->getState(); // state
```

There are the methods list of SimpleAnswer:

```
 * Class SimpleAnswer
 * @method string getVolume()
 * @method string getRepeat()
 * @method string getRandom()
 * @method string getSingle()
 * @method string getConsume()
 * @method string getPlaylist()
 * @method string getPlayListLength()
 * @method string getState()
 * @method string getSong()
 * @method string getSongId()
 */

```

---

Since default socket timeout is long enough, it was changed to 2 sec, however you can to change timeout as you like.

```
use Kolbasyatin\MPD\MPD\MPDConnection;

$connection = new MPDConnection('localhost:6600', 'yourpassword');
$connection->setSocketTimeOut(1);
```

---

###### Errors

[](#errors)

When the error occurred, an `MPDClientException` will be thrown.

In case when SimpleAnswer was used, exception will not appear, and you may check the status in an answer object.

```
$answer->getStatus();
$answer->getError();

```

That it is.

##### Commands list

[](#commands-list)

---

[Here](https://www.musicpd.org/doc/html/protocol.html#command-lists) is commands list, or you can see them in MPDClient class.

##### Testing

[](#testing)

---

Before launch `phpunit` you must start docker container.

`docker-compose -f docker/mpd/docker-compose.yml up -d`

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance53

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 87.5% 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 ~109 days

Recently: every ~153 days

Total

8

Last Release

1594d ago

Major Versions

0.0.2.1 → 1.0.02020-05-02

PHP version history (2 changes)0.0.1PHP ^7.3

1.2.0PHP ^7.3 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/7f8037cd4494f01b7015f468b56646f90ccb19bd5031c7773cbc24b7b1ad69bd?d=identicon)[Kolbasyatin](/maintainers/Kolbasyatin)

---

Top Contributors

[![Kolbasyatin](https://avatars.githubusercontent.com/u/7057456?v=4)](https://github.com/Kolbasyatin "Kolbasyatin (14 commits)")[![hmoreau](https://avatars.githubusercontent.com/u/1233146?v=4)](https://github.com/hmoreau "hmoreau (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kolbasyatin-php-mpd-client/health.svg)

```
[![Health](https://phpackages.com/badges/kolbasyatin-php-mpd-client/health.svg)](https://phpackages.com/packages/kolbasyatin-php-mpd-client)
```

PHPackages © 2026

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