PHP code example of phpstreamserver / core

1. Go to this page and download the library: Download phpstreamserver/core 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/ */

    

phpstreamserver / core example snippets


// server.php

use PHPStreamServer\Core\Server;
use PHPStreamServer\Core\Worker\ExternalProcess;
use PHPStreamServer\Core\Worker\WorkerProcess;

$server = new Server();

$server->addWorker(
    new WorkerProcess(
        name: 'Supervised Program',
        count: 1,
        onStart: function (WorkerProcess $worker): void {
            // custom long running process
        },
    ),
    new ExternalProcess(
        name: 'External supervised program',
        count: 1,
        command: 'sleep 600'
    ),
);

exit($server->run());
bash
$ php server.php start