nattreid / routing
Router extension for Nette Framework
1.2.6
2021-03-26 09:44 UTC
Requires
- php: >= 7.1
- nattreid/utils: ~1.0
- nette/application: ~2.4
- nette/di: ~2.4
Requires (Dev)
- nette/tester: ~1.7
- tracy/tracy: ~2.4
README
Nastaveni
V config.neon zaregistruje extension
extensions: router: NAttreid\Routing\DI\RoutingExtension
a nastavte. Router přebírá parametry $url a $sercure. $url => adresa, $secure => https nebo http (TRUE => https)
router: routers: - FrontRouter('//url/') - {FrontRouter('//url/'), 0} #router s prioritou configuration: locale: default: cs allowed: [cs, en]
FrontRouter
class FrontRouter extends \NAttreid\Routing\Router { public function __construct($url, PagesRepository $pageModel) { parent::__construct($url); } public function createRoutes() { $routes = $this->getRouter('Front'); $routes[] = new Route($this->url, 'Homepage:default'); $routes[] = new Route($this->url . 'index.php', 'Page:default', Route::ONE_WAY); $routes[] = new Route($this->url . '<presenter>[/<action>]', 'Page:default'); } }