public function register(Neptune $neptune) { $neptune['url'] = function ($neptune) { return new Url($neptune['config']->getRequired('neptune.routing.root_url')); }; $neptune['router'] = function ($neptune) { $router = new Router($neptune['url']); if ($cache = $neptune['config']->get('neptune.routing.cache')) { $router->setCache($neptune[$cache]); } return $router; }; $neptune['resolver'] = function ($neptune) { return new ControllerResolver($neptune); }; $neptune['router.listener'] = function ($neptune) { return new RouterListener($neptune['router'], $neptune); }; $neptune['view.extension.url'] = function ($neptune) { return new UrlExtension($neptune['router'], $neptune['url']); }; $neptune['twig.extension.routing'] = function ($neptune) { return new RoutingExtension($neptune['router'], $neptune['url']); }; }
public function loadRoutes(Router $router, Neptune $neptune) { $url = $neptune['assets.url']; $router->name('neptune:assets')->route($url . ':asset', '::controller.assets', 'serveAsset')->format(true)->argsRegex('.+'); }
protected function routes(Router $router, $prefix, Neptune $neptune) { $module = $this->getName(); $router->route("{$prefix}/login", "::{$module}.controller.bar", "{$module}_module_method"); $router->name("{$module}:secret")->route("{$prefix}/secret", "::{$module}.controller.bar", 'secretArea'); }