moirei/pipeline
最新稳定版本:0.3.0
Composer 安装命令:
composer require moirei/pipeline
包简介
Simple Laravel pipeline library.
README 文档
README
Amongst several pipeline packages, including Laravel's very own package, you might want a solution with a bit more regor for complex operations.
This package is intended for data processing and should not be a replacement for actions nor jobs. The concept of a pipeline here is a structured collection of micro tasks that happen in succession in order to yield a single output from a single input.
Documentation
All documentation is available at the documentation site.
Features
- Utility operators
- Pipeline context
- Use closures, handler classes or context methods
Example
If you're used to RxJs, you might have an appreciation for the below example. There's technically no limit to what can be done with pipelines.
$value = Pipeline::with(0)->pipe([ Pipeline::switch([ fn ($v) => $v + 1, fn ($v) => $v + 2, fn ($v) => $v + 3, ]), Pipeline::map( fn ($v) => $v * 2, ), Pipeline::tap(function (array $value) { // do whatever }), ]); // returns [2, 4, 6]
See rationale for a more exciting example.
Installation
composer require moirei/pipeline
Tests
composer test
Credits
统计信息
- 总下载量: 482
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-12-03