PHP code example of mitsuru793 / symfony-parallel-process

1. Go to this page and download the library: Download mitsuru793/symfony-parallel-process 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/ */

    

mitsuru793 / symfony-parallel-process example snippets




use Symfony\Component\Process\Process;
use Jack\Symfony\ProcessManager;

$proc1 = new Process('ls -l');
$proc2 = new Process('ls -l');

$procManager = new ProcessManager();

$processes = array();
array_push($processes, $proc1, $proc2);

$maxParallelProcesses = 5;
$pollingInterval = 1000; // microseconds
$callback = function (string $type, string $data, Process $process) {
    // do streaming
};
$procManager->runParallel($processes, $maxParallelProcesses, $pollingInterval, $callback);