sergiors/pipeline 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sergiors/pipeline

Composer 安装命令:

composer require sergiors/pipeline

包简介

Compose sequence of operations, immutable without side-effects

README 文档

README

Scrutinizer Code Quality Code Coverage Build Status

Install

composer require sergiors/pipeline

How to use

use Sergiors\Pipeline\Pipeline;

$pipeline = (new Pipeline)
    ->pipe(function ($payload) {
        return $payload + 2;
    })
    ->pipe(function ($payload) {
        return $payload * 2;
    });

echo $pipeline(10); // => 24
// echo $pipeline->process(10);
$pipeline = (new Pipeline)
    ->pipe(function ($payload, $container) {
        ...
    })
    ->pipe(function ($payload, $container) {
        ...
    });

$container = ...;
$pipeline(10, $container);

You can use Sergiors\Pipeline\Reduce, Sergiors\Pipeline\Filter and Sergiors\Pipeline\Map to compose the pipeline more readable.

use Sergiors\Pipeline\Pipeline;
use Sergiors\Pipeline\Filter;

$getOrgs = (new Pipeline)
    ->pipe(new Filter(function ($org) {
        return $org instanceof OrgInterface;
    }));

// an array with OrgInterface and UserInterface objects
$users = [...];

print_r($getOrgs($users));

Motivation

Collection Pipeline

License

MIT

统计信息

  • 总下载量: 40
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 19
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 19
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-06-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固