geniv / nette-static-router

此包已被废弃,不再维护。未建议替代包。

Nette 框架的静态别名路由扩展

v1.0.4 2018-02-15 23:17 UTC

This package is auto-updated.

Last update: 2020-02-13 18:22:21 UTC


README

安装

$ composer require geniv/nette-static-router

"geniv/nette-static-router": ">=1.0.0"

require

"php": ">=5.6.0",
"nette/nette": ">=2.4.0",
"geniv/nette-locale": ">=1.0.0"

在应用中包含

neon 配置

# static router
staticRouter:
#   autowired: self
#   domainSwitch: false
#   domainAlias:
#        example.cz: cs
#        example.com: en
#        example.de: de
    route:
        cs:
            "staticky-slug": "Homepage:pokus"
            "staticky-slug1": "Homepage:pokus2"
        en:
            "static-slu": "Homepage:pokus"
            "static-slug1": "Homepage:pokus2"

neon 配置扩展

extensions:
    staticRouter: StaticRouter\Bridges\Nette\Extension

RouterFactory.php

public static function createRouter(ILocale $locale, StaticRouter $staticRouter): IRouter
...
$router[] = $staticRouter;
$staticRouter->setDefaultParameters('Homepage', 'default', 'cs');
$staticRouter->setPaginatorVariable('visualPaginator-page');
//$staticRouter->setSecure(true);
//$staticRouter->setOneWay(true);