dev-master
9999999-devSimple PHP Wrapper for MDP is a PHP class for interfacing with the MPD Music Daemon. It allows you to develop an API to interface with MPD
MIT
The Requires
by Mutant Labs
api php rest restful mpd mopidy
Wallogit.com
2017 © Pedro Peláez
Simple PHP Wrapper for MDP is a PHP class for interfacing with the MPD Music Daemon. It allows you to develop an API to interface with MPD
Depends on https://github.com/marcj/php-rest-service, (*1)
Install simplempd with Composer:, (*2)
Create a composer.json:, (*3)
{
"require": {
"mutantlabs/simplempd": "dev-master"
}
}
and run, (*4)
$ wget http://getcomposer.org/composer.phar $ php composer.phar install
After the installation, you need to include the vendor/autoload.php to make the class in your script available., (*5)
include 'vendor/autoload.php';
htaccess Example:, (*6)
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Simple PHP Wrapper for MDP is a PHP class for interfacing with the MPD Music Daemon. It allows you to develop an API to interface with MPD, (*7)
use SimpleMPDWrapper, (*8)
use MPDWrapper\SimpleMPDWrapper;
Construct a new SimpleMPDWrapper instance Required parameters: Password, MPD Server address, Port, Refresh interval, (*9)
$mp = new SimpleMPDWrapper("","192.168.0.1",6600,0);
Send a command using the send method:, (*10)
echo json_encode($mp->send("add", "spotify:track:48mZ0CGCffjH49h5lAPTIe"));
Or utilise the quick method wrappers, (*11)
echo json_encode($mp->add("spotify:track:48mZ0CGCffjH49h5lAPTIe"));
include 'vendor/autoload.php';
use MPDWrapper\SimpleMPDWrapper;
use RestService\Server;
Server::create('/')
->addGetRoute('add/(.*)', function($data){
$mp = new SimpleMPDWrapper("","192.168.1.120",6600,0);
$response = array(
'message' => 'track sent to mutant playlist',
'track' => $data,
'response' => $mp->add($data)
);
return $response;
})
->run();
Simple PHP Wrapper for MDP is a PHP class for interfacing with the MPD Music Daemon. It allows you to develop an API to interface with MPD
MIT
api php rest restful mpd mopidy