ptachoire/process-builder-chain

此包已被弃用,不再维护。没有建议的替代包。

增加链式调用 symfony 流程的能力

1.3.0 2017-12-06 12:24 UTC

This package is not auto-updated.

Last update: 2020-07-16 12:25:56 UTC


README

为 symfony 流程构建器或流程添加链式调用能力

安装

composer install

用法

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();

还有更详细的 API 可用

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

测试

phpunit

致谢

项目结构受 Negotiation by willdurand 启发。

许可证

phprocess-builder-chain 在 MIT 许可证下发布。有关详细信息,请参阅捆绑的 LICENSE 文件。