PHP code example of yjx / easy-pipeline

1. Go to this page and download the library: Download yjx/easy-pipeline library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

yjx / easy-pipeline example snippets


$response = (new EasyPipeline\Pipeline())
	->send($request)
	->through($middlewares)
	->then($dispatch);

$middlewares = [
	VerifyCsrfToken::class,	// 类名
	
	[ThrottleRequests::class, [60, 1]],	// 数组形式: 类名 + 数组参数
	
	ThrottleRequests::class."?60:1",	// 字符串形式: 类名 + 参数
	
	"throttle?60:1",	// 字符串别名形式: 管理实例化时需传入容器实例
	
	function ($request, \Closure $next) {	// 闭包
		//...
		return $next($request);
	},
];