PHP code example of steevanb / php-parallel-processes

1. Go to this page and download the library: Download steevanb/php-parallel-processes 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/ */

    

steevanb / php-parallel-processes example snippets




declare(strict_types=1);

use Steevanb\ParallelProcess\{
    Console\Application\ParallelProcessesApplication,
    Process\Process
};
use Symfony\Component\Console\Input\ArgvInput;

# If you use the official Docker image, you should use the Composer global autoload
s(['second', 'process']))->setName('Second process'))
    ->run(new ArgvInput($argv));

(new ParallelProcessesApplication())
    // Timeout is in seconds, here we will have a 10s timeout
    ->setTimeout(10)

(new ParallelProcessesApplication())
    // Timeout is in microseconds, here we will have a 500ms timeout
    ->setRefreshInterval(50000)

(new ParallelProcessesApplication())
    // Here we will have maximum 3 processes in parallel
    ->setMaximumParallelProcesses(3)

use Steevanb\ParallelProcess\Console\Application\Theme\DefaultTheme();

(new ParallelProcessesApplication())
    ->setTheme(new DefaultTheme())
bash
composer 
bash
php parallel-processes.php --theme summary