ikarus/sps-server

v0.1.5 2020-04-21 19:18 UTC

This package is auto-updated.

Last update: 2024-05-22 05:09:13 UTC


README

The server package of Ikarus SPS provides plugins to establish unix and/or tcp connections to communicate with a running sps.

Installation

$ composer require ikarus/sps-server

Usage

Cyclic

<?php
use Ikarus\SPS\CyclicEngine;
use Ikarus\SPS\Server\Cyclic\ServerPlugin;

$sps = new CyclicEngine(2, 'Test SPS');
// add the plugins your need to run properly

$sps->addPlugin( new ServerPlugin('192.168.1.100', 8686) );
$sps->run();

Triggered

<?php
use Ikarus\SPS\TriggeredEngine;
use Ikarus\SPS\Server\Trigger\ServerPlugin;

$sps = new TriggeredEngine('Test SPS');
// add the plugins your need to run properly

$sps->addPlugin( new ServerPlugin('192.168.1.100', 8686) );
// or local unix server
$sps->addPlugin( new ServerPlugin('/tmp/example-sps.sock') );
$sps->run();

Now any application will be able to call the sps via tcp://192.168.1.100 on port 8686.

Please note that we don't recommend to add more than one server plugin. The SPS would accept them but it might cause conflicts.