jascha030 / process-chain
Chain symfony/process commands together.
1.1.0
2024-11-18 11:23 UTC
Requires
- php: >=8.2
- illuminate/collections: ^10.48
- phpoption/phpoption: ^1.9
- symfony/console: ^7.1
- symfony/process: ^7.1
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.8
- roave/security-advisories: dev-latest
- symfony/filesystem: ^6.2
- symfony/var-dumper: ^6.2
README
Chain symfony/process commands together.
Getting started
Prerequisites
- php:
>=8.1 - Composer
^2.3
Installation
composer require jascha030/process-chain
Usage
<?php
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";
}
License
This composer package is an open-sourced software licensed under the MIT License