philwc/subsonic-api-client

v0.0.4 2017-12-22 16:31 UTC

This package is not auto-updated.

Last update: 2024-04-18 03:02:56 UTC


README

PHP Client For Subsonic

Usage

Create a new configuration object:

// Assumes the config items are in the environment (via dotenv etc.)
$config = new \philwc\Configuration(getenv('SUBSONIC_URL'), getenv('SUBSONIC_USER'), getenv('SUBSONIC_PASSWORD'))

Either set the config into the ClientFactory:

\philwc\ClientFactory::setConfiguration($config);

Or pass into each ClientFactory::get() call:

$createPlaylist = \philwc\ClientFactory::get(\philwc\Call\Playlist\CreatePlaylist::class, $config);

To make the call, invoke the class:

$createPlaylist(['name' => 'Test Playlist', 'songId' => 1]);

Each call class can receive different parameters and will return a different result.

Use getAvailableFields(), getRequiredFields(), getResponseClass() as appropriate.

Currently, the following calls are implemented:

Playlist

  • CreatePlaylist
  • DeletePlaylist
  • GetPlaylist
  • GetPlaylists
  • UpdatePlaylist

Searching

  • Search2

System

  • GetLicense
  • Ping