simple-php-router
simple-php-router copied to clipboard
Make current processing rule accessible
With this PR i want to resolve my bad solution from #598
I added a new global variable which will contains the current processing rule while processing. So the data (like rule name) are usable in the middleware:
namespace My\Router\Namespace;
use Pecee\Http\Middleware\IMiddleware;
use Pecee\Http\Request;
use Pecee\SimpleRouter\SimpleRouter as Router;
class test implements IMiddleware
{
public function handle(Request $request) : void
{
$router = Router::router();
$RouteName = $router->getCurrentProcessingRoute()->getName();
}
}
Thanks for merging.
Kind regards
waiting to merge this good work!
hi @Clrkz
i changed the repo to this fork: https://github.com/DeveloperMarius/simple-php-router/tree/v5-development-php8
There are some fixes for php8 and many other things. The most of open PRs from this project were merged in the forked repo, this PR also.
Kind regards