net_bazzline/php_component_process_pipe
Composer 安装命令:
composer require net_bazzline/php_component_process_pipe
包简介
free as in freedom php component process to easy up creation of pipe process in php
README 文档
README
This free as in freedom component ease up creation of a pipe for processes in php.
Indeed, it is a pseudo pipeline (process collection or process batch) since the php process is single threaded so far.
Currently, there is no plan to bloat the code base with an implementation of STDIN, STDOUT or STDERR. Errors can be handled by the thrown exception. Input is defined by the ExecutableInterface, as well as the output (return value).
The build status of the current master branch is tracked by Travis CI:
It is also available at openhub.net.
Changelog can be found here.
Why?
- separate complex operations into simpler
- easy up unit testing for smaller processes
- separate responsibility (data generator/transformer/validator/flow manipulator)
- create process chains you can read in the code (separate integration code from operation code)
- no dependencies (except you want to join the development team)
Examples
- no input
- input array
- failing execution
- input generator
- input transformer
- input validator
- data flow manipulator
Install
By Hand
mkdir -p vendor/net_bazzline/php_component_process_pipe
cd vendor/net_bazzline/php_component_process_pipe
git clone https://github.com/bazzline/php_component_process_pipe
With Packagist
composer require net_bazzline/php_component_process_pipe:dev-master
Usage
By using the pipe method for multiple process
use Net\Bazzline\Component\ProcessPipe\ExecutableException; use Net\Bazzline\Component\ProcessPipe\InvalidArgumentException; use Net\Bazzline\Component\ProcessPipe\Pipe; try { $pipe = new Pipe(); $pipe->pipe( new ProcessOne(), new ProcessTwo() ); $output = $pipe->execute($input); } catch (ExecutableException) { //handle process exception } catch (InvalidArgumentException) { //handle pipe exception }
By using the pipe method once for each process
use Net\Bazzline\Component\ProcessPipe\ExecutableException; use Net\Bazzline\Component\ProcessPipe\InvalidArgumentException; use Net\Bazzline\Component\ProcessPipe\Pipe; try { $pipe = new Pipe(); $pipe->pipe(new ProcessOne()); $pipe->pipe(new ProcessTwo()); $output = $pipe->execute($input); } catch (ExecutableException) { //handle process exception } catch (InvalidArgumentException) { //handle pipe exception }
By instantiation
use Net\Bazzline\Component\ProcessPipe\ExecutableException; use Net\Bazzline\Component\ProcessPipe\InvalidArgumentException; use Net\Bazzline\Component\ProcessPipe\Pipe; try { $pipe = new Pipe( new ProcessOne(), new ProcessTwo() ); $output = $pipe->execute($input); } catch (ExecutableException) { //handle process exception } catch (InvalidArgumentException) { //handle pipe exception }
By doing all
use Net\Bazzline\Component\ProcessPipe\ExecutableException; use Net\Bazzline\Component\ProcessPipe\InvalidArgumentException; use Net\Bazzline\Component\ProcessPipe\Pipe; try { $pipe = new Pipe( new ProcessOne(), new ProcessTwo() ); $pipe->pipe(new ProcessThree()); $pipe->pipe( new ProcessFour(), new ProcessFive() ); $output = $pipe->execute($input); } catch (ExecutableException) { //handle process exception } catch (InvalidArgumentException) { //handle pipe exception }
API
API is available at bazzline.net.
Development notes
After code changes, please run:
composer check ./vendor/bin/rector process ./vendor/bin/php-cs-fixer fix example ./vendor/bin/php-cs-fixer fix source ./vendor/bin/php-cs-fixer fix test
Links
Thanks to
Other pipe implementations
Final Words
Star it if you like it :-). Add issues if you need it. Pull patches if you enjoy it. Write a blog entry if you use it. Donate something if you love it :-].
net_bazzline/php_component_process_pipe 适用场景与选型建议
net_bazzline/php_component_process_pipe 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.16k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2014 年 11 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「process」 「component」 「pipe」 「psr」 「bazzline」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 net_bazzline/php_component_process_pipe 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 net_bazzline/php_component_process_pipe 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 net_bazzline/php_component_process_pipe 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Doctrine implementation of the MetaborStd (Statemachine) for PHP 8.2+
FSi DataSource Component
Shell command module for PHP.
Swoole server process management
Inbox pattern process implementation for your Laravel Applications
Priveate for SkeekS CMS
统计信息
- 总下载量: 1.16k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 18
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: LGPLv3
- 更新时间: 2014-11-10