PHP code example of orkestra / daemon

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

    

orkestra / daemon example snippets

 php


tra\Daemon\Daemon;
use Orkestra\Daemon\Worker\PcntlWorker;

$daemon = new Daemon();
$daemon->addWorker(new PcntlWorker('/path/to/executable', array('--arg=value')));

$daemon->execute();
 php


tra\Daemon\Daemon;
use Orkestra\Daemon\Worker\ProcessWorker;
use Symfony\Component\Process\Process;

$process = new Process('/path/to/executable --arg=value');

$daemon = new Daemon();
$daemon->addWorker(new ProcessWorker($process));

$daemon->execute();