Download the PHP package sharkydog/snapcast-client without Composer

On this page you can find all versions of the php package sharkydog/snapcast-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package snapcast-client

snapcast-client

Snapcast JSON-RPC api wrapper in PHP

This library provides basic connectivity to the Snapcast server using its JSON-RPC api and a raw TCP socket. Commands and responses are linked using ReactPHP promises, notifications are available as EventEmitter events.

The client class has an automatic reconnect feature which can be adjusted or stopped during runtime.

Usage

By default client will connect with 2 seconds timeout and try to reconnect after 5 seconds if connect failed, connection was dropped or closed by the remote side. This can be changed.

SharkyDog\Snapcast\Client reference

Events

event [parameter1, parameter2, ...]

Notifications will also be emitted with method as event and params as single parameter, like: Stream.OnUpdate [\stdClass $params]

Helpers

There is an abstract class (SharkyDog\Snapcast\ClientApp) that helps create additional and more specific logic by binding events to class methods.

Restore player stream

SharkyDog\Snapcast\App\RestorePlayerStream is one such class. It will monitor the snapcast server for players being added to or removed from groups and will remember the set stream when a player is alone in a group. Then, when the player is removed from a group and is placed alone in a new group, the stream will be restored to the remembered one or to a configured default per player.

Data directory provided in the constructor is where player state is saved and where config is read from. After client has been set and it connects, RestorePlayerStream will start monitoring the server for stream changes and will save the last used stream for every player when it is alone in a group, but will not do anything else until some configuration is done in the data directory.

For every player there will be a file like stat_name_id, ex.: stat_Snapclient_on_Server_aa_bb_cc_dd_ee_ff. Filename is formed from player name and id after non alphanumeric characters are replaced with underscore. If player name is not set, used name for the stat filename will be noname. Content of this file is the last saved stream id.

In the same directory, a config file will be read when the player is removed from a group. These files must be created and managed by you, RestorePlayerStream will not write or delete them.

The config file is per player and can be named conf_name_id or conf_id or conf_name or conf_default. RestorePlayerStream will look for them in that order. The file conf_default would be picked last for any player, but obviously can also be picked by a player with name or id "default".

If you want the player to be restored to the last used stream:

If you want to set the current saved stream as default:


All versions of snapcast-client with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
react/socket Version ^1.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sharkydog/snapcast-client contains the following files

Loading the files please wait ...