yuriitatur / pipeline
A simple pipeline for running middleware
v1.0.0
2025-08-04 16:44 UTC
Requires
- php: >=8.2
Requires (Dev)
- phpunit/phpunit: ^12.0
This package is auto-updated.
Last update: 2025-08-04 16:45:20 UTC
README
Simple middleware pipe | refined Laravel's pipes
Installation
composer require yuriitatur/pipeline
Usage
class AuthMiddleware implements MiddlewareInterface
{
public function handle(&$request, \Closure $next, ...$roles): mixed
{
#...do some magic
}
}
$pipe = new Pipeline();
$response = $pipe->send($request)
->through(new AuthMiddleware, 'admin', 'super_admin')
->through(new SomeOtherMiddleware)
->then(function($request){
#...handle the request
});
Testing
composer test
License
This code is under MIT license, read more in the LICENSE file.