Simply Middleware Implementation.
composer require fitdev-pro/middleware
Base usage
<?php
$hundler = new MiddlewareHundler(new Resolver(), new Queue());
$hundler->append(Foo/Bar/SomeClass::class);
$hundler->append(function ($input, $output, $next){
$data += 1;
return $next($data);
});
$hundler->append(function ($input, $output, $next){
$data += 2;
if($data > 4){
return $data;
}
return $next($data);
});
$hundler->append(function ($input, $output, $next){
$data += 3;
return $next($data);
});
$newData = $hundler->hundle(2);Please feel free to fork and extend existing or add new plugins and send a pull request with your changes! To establish a consistent code quality, please provide unit tests for all your changes and may adapt the documentation.
The MIT License (MIT). Please see License File for more information.