PHP code example of bluepsyduck / symfony-process-manager
1. Go to this page and download the library: Download bluepsyduck/symfony-process-manager 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/ */
bluepsyduck / symfony-process-manager example snippets
use BluePsyduck\SymfonyProcessManager\ProcessManager;
use Symfony\Component\Process\Process;
$numberOfParallelProcesses = 4; // The number of processes to execute in parallel.
$pollInterval = 100; // The interval to use for polling the processes, in milliseconds.
$processStartDelay = 0; // The time to delay the start of processes to space them out, in milliseconds.
$processManager = new ProcessManager($numberOfParallelProcesses, $pollInterval, $processStartDelay);
// Add some processes
// Processes get executed automatically once they are added to the manager.
// If the limit of parallel processes is reached, they are placed in a queue and wait for a process to finish.
$processManager->addProcess(Process::fromShellCommandline('ls -l'));
$processManager->addProcess(Process::fromShellCommandline('ls -l'));
// Wait for all processes to finish
$processManager->waitForAllProcesses();
use BluePsyduck\SymfonyProcessManager\ProcessManager;
use Symfony\Component\Process\Process;
$processManager = new ProcessManager();
$processManager->setProcessStartCallback(function (Process $process): void {
echo 'Starting process: ' . $process->getCommandLine();
});
$processManager->addProcess(Process::fromShellCommandline('ls -l'));
$processManager->waitForAllProcesses();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.