PHP code example of ikarus / sps-multi-processing

1. Go to this page and download the library: Download ikarus/sps-multi-processing 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-multi-processing example snippets



use Ikarus\SPS\CyclicEngine;
use Ikarus\SPS\SpawnedFileSPSPlugin;
use Ikarus\SPS\SpawnedCallbackSPSPlugin;
use Ikarus\SPS\SpawnedPluginAdapterPlugin;


$sps = new CyclicEngine(2);

$sps->addPlugin(
    new SpawnedFileSPSPlugin('my-sub-sps.php', 'my-id')
);

$sps->addPlugin(
    new SpawnedCallbackSPSPlugin(function() {
        // Do stuff but remember that this callback is executed in a separated process!
        // To get a plugin management you need to setup it in main SPS and