chomenko / route-listener
There is no license information available for the latest version (v1.0.0) of this package.
Router listener from Nette framework
v1.0.0
2019-06-21 13:27 UTC
Requires
- php: >=7.2
- kdyby/events: ^3.1
- nette/di: ^2.4
This package is auto-updated.
Last update: 2024-10-22 00:58:54 UTC
README
This extension allows you to extend your router
Required
Install
composer require chomenko/route-listener
Configure
in config.neon
extensions: events: Kdyby\Events\DI\EventsExtension #console: Kdyby\Console\DI\ConsoleExtension routeListener: Chomenko\RouteListener\DI\RouteListenerExtension
Use
Events
- onMatch
- onMatched
- onConstructUrl
- onConstructedUrl
<?php namespace App\Listener; use Kdyby\Events\Subscriber; use Nette\Application\Routers\RouteList; use Nette\Application\Request; class EventRoute implements Subscriber { /** * @return array */ public function getSubscribedEvents() { return [ RouteList::class . "::onConstructUrl" => "onConstructUrl", ]; } /** * @param IRouter $routerList * @param Request $request */ public function onConstructUrl(IRouter $routerList, Request $request) { $parameters = $request->getParameters(); $parameters["foo"] = "bar"; $request->setParameters($parameters); } }