# php-pipeline **Repository Path**: liuxiaojinla/php-pipeline ## Basic Information - **Project Name**: php-pipeline - **Description**: 基于 league/pipeline 实现几种管道模式,线性调度管道器、线性调度管道器(可中断)、调用中间件管道器等 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2025-01-09 - **Last Updated**: 2025-01-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Pipeline | 管道 #### 介绍 Pipeline(管道)是一种设计模式或概念,用于将多个处理步骤或任务组合成一个连续的处理流,以便数据从一个处理阶段传递到下一个阶段 。每个阶段通常执行某种操作,最后将结果传递给下一个阶段,直到整个流程完成 #### 软件架构 基于 `league/pipeline` 实现几种管道模式,线性调度管道器、线性调度管道器(可中断)、调用中间件管道器等 #### 安装教程 `composer require xin/pipeline` #### 使用说明 **构建统一化支付器** ```php use Xin\Pipeline\PipelineManager; require_once './vendor/autoload.php'; $pipeline = new \Xin\Pipeline\PipelineManager(); $pipeline->pushMany([ function ($x, $next) { var_dump('1:request'); $value = $next($x); var_dump('1:' . $value); return $value; }, function ($x, $next) { var_dump(2); return $next($x); }, ]); $value = $pipeline->middleware(1, function ($input) { var_dump("input:" . $input); return $input * 100; }); var_dump("value:" . $value); ```