Search by

xin / pipeline

xin

There is no license information available for the latest version (v1.0.0) of this package.

This package's canonical repository appears to be gone and the package has been frozen as a result. Email us for help if needed.

v1.0.0 2025-01-09 03:35 UTC

This package is auto-updated.

Last update: 2025-09-02 19:27:36 UTC


README

介绍

Pipeline(管道)是一种设计模式或概念,用于将多个处理步骤或任务组合成一个连续的处理流,以便数据从一个处理阶段传递到下一个阶段 。每个阶段通常执行某种操作,最后将结果传递给下一个阶段,直到整个流程完成

软件架构

基于 league/pipeline 实现几种管道模式,线性调度管道器、线性调度管道器(可中断)、调用中间件管道器等

安装教程

composer require xin/pipeline

使用说明

构建统一化支付器


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