Skip to content

A client library to connect to a running sps and sending commands

License

Notifications You must be signed in to change notification settings

tasoftch/ikarus-sps-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ikarus SPS Client

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);
// ...

About

A client library to connect to a running sps and sending commands

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages