PHP code example of ikarus / sps-client

1. Go to this page and download the library: Download ikarus/sps-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ikarus / sps-client example snippets



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";
}


use Ikarus\SPS\Client\TcpClient;

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