ptachoire/process-builder-chain

This package is abandoned and no longer maintained. No replacement package was suggested.

Add ability to chain symfony processes

1.3.0 2017-12-06 12:24 UTC

This package is not auto-updated.

Last update: 2024-10-31 22:44:34 UTC


README

Add chain ability to symfony process builder or process

Install

composer install

Usage

use Chain\Chain;

$chain = new Chain($process);

$chain->add('|', $process);
$chain->add('&&', $process);
$chain->add('>', $output);
// see the Chain\Chain source code for all accepted links

$chain->getProcess();

A more verbose API is also available:

use Chain\Chain;

$chain = new Chain(new Process('cat'));
$chain
    ->input('input.txt')
    ->pipe('sort')
    ->andDo('pwgen')
    ->output('result.log')
    ->errors('/dev/null');

// see the Chain\Chain source code for all accepted links

$chain->getProcess(); // cat < input.txt | sort && pwgen > result.log 2> /dev/null

Test

phpunit

Credits

Project structure inspired by Negotiation by willdurand.

License

phprocess-builder-chain is released under the MIT License. See the bundled LICENSE file for details.