PHP code example of jascha030 / process-chain
1. Go to this page and download the library: Download jascha030/process-chain 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/ */
jascha030 / process-chain example snippets
use Jascha030\Process\Chain\ProcessChain;
use Symfony\Component\Console\Output\ConsoleOutput;
// Define the commands to run in the process chain
$commands = [
'echo "Hello"',
'echo "World"',
];
// Create a new instance of the ProcessChain class
$processChain = ProcessChain::create(
$commands,
new ConsoleOutput()
);
// Disable output for the processes in the chain
$processChain->disableOutput();
// Run the processes in the chain
$processChain->mustRun();
// Get the exit codes for the processes in the chain
$exitCodes = $processChain->getExitCodes();
// Output the exit codes for each command
foreach ($exitCodes as $command => $exitCode) {
echo "{$command} exited with code {$exitCode}\n";
}