PHP code example of chomenko / route-listener
1. Go to this page and download the library: Download chomenko/route-listener 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/ */
chomenko / route-listener example snippets
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);
}
}