MphpD

The Main MphpD class.

new MphpD(array $config = []) : MphpD

Methods

__construct

MphpD::__construct(array $options = []) : mixed

Parameters

Returns mixed

db

Return the DB instance

MphpD::db() : FloFaber\MphpD\DB

Parameters

Returns FloFaber\MphpD\DB

\DB

player

Return the Player instance

MphpD::player() : FloFaber\MphpD\Player

Parameters

Returns FloFaber\MphpD\Player

\Player

queue

Return the Queue instance

MphpD::queue() : FloFaber\MphpD\Queue

Parameters

Returns FloFaber\MphpD\Queue

\Queue

playlist

Returns a Playlist instance with the given name or null if the name is empty

MphpD::playlist(string $name) : FloFaber\MphpD\Playlist

Parameters

Returns FloFaber\MphpD\Playlist

\Playlist|null

playlists

Returns a list of playlists.

MphpD::playlists(bool $metadata = ) : mixed

Parameters

Returns mixed

array|false array on success or false on failure.

output

Return a new output instance

MphpD::output(int $id) : FloFaber\MphpD\Output

Parameters

Returns FloFaber\MphpD\Output

\Output

outputs

Returns an Array of associative arrays containing all available outputs

MphpD::outputs() : mixed

Parameters

Returns mixed

array|false array on success or false on failure.

neighbors

Return neighbors on the network like available SMB servers

MphpD::neighbors() : mixed

Parameters

Returns mixed

array|false array on success or false on failure.

partition

Return a new Partition instance

MphpD::partition(string $name) : FloFaber\MphpD\Partition

Parameters

Returns FloFaber\MphpD\Partition

\Partition

partitions

Return a list of all available partitions

MphpD::partitions() : mixed

Parameters

Returns mixed

array|false array on success or false on failure.

channel

Return a new Channel instance

MphpD::channel(string $name = '') : FloFaber\MphpD\Channel

Parameters

Returns FloFaber\MphpD\Channel

\Channel

channels

Return a list of available channels

MphpD::channels() : mixed

Parameters

Returns mixed

array|bool array on success or false on failure.

clear_error

Clears the current error

MphpD::clear_error() : bool

Parameters

Returns bool

bool true on success or false on failure.

status

Returns the value of the specified key(s) from MPD's status.

MphpD::status(array $items = []) : mixed

Parameters

Returns mixed

array|false|int|float|null false on error

string, int, float or null if $items contains only one item. If it does not exist null will be returned instead.

Otherwise, an associative array containing all available (or specified) keys.

stats

Returns the value of the specified key from MPD's stats.

MphpD::stats(array $items = []) : mixed

Parameters

Returns mixed

array|false|int|null Returns false on error

string, int or null if $items contains only one item. If it does not exist null will be returned instead.

Otherwise, an associative array containing all available (or specified) stats.

sticker

Returns a Sticker instance

MphpD::sticker(string $type, string $uri) : FloFaber\MphpD\Sticker

Parameters

Returns FloFaber\MphpD\Sticker

\Sticker

mounts

Return a list of all mounts.

MphpD::mounts() : mixed

Parameters

Returns mixed

array|false

mount

Mount $uri to path

MphpD::mount(string $path, string $uri) : bool

Parameters

Returns bool

bool true on success or false on failure.

unmount

Unmount a path

MphpD::unmount(string $path) : bool

Parameters

Returns bool

bool true on success or false on failure.

bulk_start

Function to start a command-list.

MphpD::bulk_start() : mixed

Parameters

Returns mixed

void

bulk_end

Function to end a command-list and execute its commands. The command list is stopped in case an error occurs.

MphpD::bulk_end() : array

Parameters

Returns array

array|false array containing the commands responses or false on failure.

bulk_abort

Function to abort the current command list. We can do that because we only start the list at protocol level when bulk_end() is called.

MphpD::bulk_abort() : mixed

Parameters

Returns mixed

void

bulk_add

Function to add a command to the bulk_list.

MphpD::bulk_add(string $cmd, array $params = [], int $mode = 32) : bool

Parameters

Returns bool

bool

tagtypes

Return a list of all available tag types.

MphpD::tagtypes() : mixed

Parameters

Returns mixed

array|false array on success or false on failure.

tagtypes_disable

Disable specified tag types.

MphpD::tagtypes_disable(array $tagtypes) : bool

Parameters

Returns bool

bool true on success or false on failure.

tagtypes_enable

Enable specified tag types.

MphpD::tagtypes_enable(array $tagtypes) : bool

Parameters

Returns bool

bool true on success or false on failure.

tagtypes_clear

Remove all tag types from responses.

MphpD::tagtypes_clear() : bool

Parameters

Returns bool

bool true on success or false on failure.

tagtypes_all

Enable all available tag types.

MphpD::tagtypes_all() : bool

Parameters

Returns bool

bool true on success or false on failure.

ping

Ping.

MphpD::ping() : bool

Parameters

Returns bool

bool true on success or false on failure.

config

Returns an associative array of configuration values. This function is only available for client connected via Unix Socket!

MphpD::config() : mixed

Parameters

Returns mixed

array|false array containing configuration parameters on success or false on failure.

commands

Returns a list of all available commands.

MphpD::commands() : mixed

Parameters

Returns mixed

array|false array on success or false on failure.

notcommands

Returns a list of all not-available commands.

MphpD::notcommands() : mixed

Parameters

Returns mixed

array|false array on success or false on failure.

urlhandlers

Returns a list of all available urlhandlers. Like smb://, sftp://, http://. ..

MphpD::urlhandlers() : mixed

Parameters

Returns mixed

array|false array on success or false on failure.

decoders

Returns a list of available decoder plugins and their supported suffixes and mimetypes.

MphpD::decoders() : mixed

Parameters

Returns mixed

array|false array on success or false on failure.

cmd

Send $command with $params to the MPD server. You, the library's user, are not intended to ever need this method. If you ever need it because the library does not support a specific command please file a bug report. This method also parses MPDs response depending on the chosen mode.

MphpD::cmd(string $command, array $params = [], int $mode = 2, array $list_start = []) : mixed

Parameters

Returns mixed

array|bool False on failure. Array on success. True on success if $mode is MPD_CMD_READ_BOOL.

get_socket

Returns the socket resource.

MphpD::get_socket() : mixed

Parameters

Returns mixed

resource

get_version

Returns MPDs version as string

MphpD::get_version() : string

Parameters

Returns string

string

version_bte

Function to compare a given version string with the current version of MPD

MphpD::version_bte(string $version) : bool

Parameters

Returns bool

bool Returns true if MPDs version is equal to or newer than the given version. False otherwise.

idle

Waits until there is a noteworthy change in one or more of MPD’s subsystems.

MphpD::idle(string $subsystem = '', int $timeout = 60) : mixed

Parameters

Returns mixed

array|false array of changed subsystems or false on timeout.

close

Close the connection to the MPD socket

MphpD::close() : void

Parameters

Returns void

void

kill

Kill MPD.

MphpD::kill() : void

Parameters

Returns void

void

get_binarylimit

Returns the current binarylimit

MphpD::get_binarylimit() : int

Parameters

Returns int

int The current binarylimit.

set_error

Function to set the last occurred error. Should only be used inside the library!

MphpD::set_error( $err) : bool

Parameters

Returns bool

false

get_last_error

Return an array containing information about the last error.

MphpD::get_last_error() : array

Parameters

Returns array

array associative array containing the following keys: [ "code" => (int), "message" => (string), "command" => (string), "commandlistnum" => (int) ]

connect

Initiate connection to MPD with the parameters given at instantiation.

MphpD::connect() : bool

Parameters

Returns bool

bool true on success or false on failure.

disconnect

Disconnect from MPD

MphpD::disconnect() : mixed

Parameters

Returns mixed

void

© 2023 Florian Faber