ikarus/sps-client

Installs: 48

Dependents: 4

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/ikarus/sps-client

v0.2.2 2020-07-01 09:37 UTC

This package is auto-updated.

Last update: 2025-09-29 02:08:16 UTC


README

The client package is an independent library to connect to services using unix sockets or tcp/ip.
It is basically designed to communicate with a running sps, but you can use it anywhere.

Installation

$ composer require ikarus/sps-client

Usage

<?php
use Ikarus\SPS\Client\UnixClient;
use Ikarus\SPS\Client\Command\Command;

$client = new UnixClient('/tmp/ikarus-sps.sock');
$response = $client->sendCommand($cmd = new Command('status', ['battery', 'power', 'problems']));

if($response == $client::STATUS_OK) {
    echo $cmd->getResponse(); // Whatever your sps answered
} else {
    echo "Failed to execute command";
}

To use tcp/ip clients, change the $client:

<?php
use Ikarus\SPS\Client\TcpClient;

$client = new TcpClient('192.168.1.100', 8686);
// ...