Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/saksmt/pmpd
PHP MPD Client Library
https://github.com/saksmt/pmpd
Last synced: about 2 months ago
JSON representation
PHP MPD Client Library
- Host: GitHub
- URL: https://github.com/saksmt/pmpd
- Owner: saksmt
- License: mit
- Created: 2015-11-18T16:53:44.000Z (about 9 years ago)
- Default Branch: develop
- Last Pushed: 2015-12-07T18:54:40.000Z (about 9 years ago)
- Last Synced: 2024-01-27T16:20:20.832Z (11 months ago)
- Language: PHP
- Size: 34.2 KB
- Stars: 2
- Watchers: 4
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PMPD
====PHP client library for Music Player Daemon
Prerequesties
-------------- PHP 5.6+
- Running MPD :)Installation
------------composer require smt/pmpd dev-develop
Usage
-----use Smt\Pmpd\Client\Impl\DefaultClient;
use Smt\Pmpd\Configuration\HostConfiguration;
use Smt\Pmpd\Connection\Commands;
use Smt\Pmpd\Connection\ConnectionFactory;
use Smt\Pmpd\Entity\Enum\PlaybackState;
use Smt\Pmpd\Response\FailResponse;$connectionFactory = new ConnectionFactory();
$config = new HostConfiguration();
$config->setHost('127.0.0.1');
$connection = $connectionFactory->createConnection($config);
$client = new DefaultClient($connection);echo $client->getCurrent()->getTitle() . ' playing: ';
echo $client->getStatus()->getState() == PlaybackState::PLAYING . PHP_EOL;
$client->next();
$client->toggle();
$client->play();
$client->updateDatabaseAsync();
$response = $client->query(Commands::ADD_AND_RETURN_ID, 'Asking Alexandria - Not The American Average.flac', 1); // Add it to first position
if ($response instanceof FailResponse) {
echo 'Something gone wrong :(' . PHP_EOL . PHP_EOL . $response->getMessage();
} else {
echo 'Id in playlist:' . $response->get('Id') . PHP_EOL;
}
For more see [documentation](https://github.com/saksmt/pmpd/blob/develop/doc)Roadmap
-------- [X] Implement connection with password;
- [X] Write API documentation;
- [X] Cover with tests
- [ ] Rewrite client to facade with subsystems;License
-------This library is licensed under [MIT license](https://github.com/saksmt/pmpd/blob/develop/LICENSE)