Router mount

File configs/services.php

Why only works if i include the file, all others DI accept class call.


$di->set('router', function () {

    $router = new Router();
    include __DIR__.'/../library/System/Routes/Admin.php';
    include __DIR__.'/../library/System/Routes/Frontend.php';
    $router->mount(new \System\Routes\Frontend);
    $router->mount(new \System\Routes\Admin);

        "controller" => "index",
        "action" => "notfound"

    return $router;

You have to configure the loader to autoload those classes.

edited Jul '15

But they are configured, all other $di->set the class's works

Example $di dispatcher My class \System\Layout, Acl, Assets works fine

all others di set also, only router that does not load

$di->set('dispatcher', function() use ($di)
    $dispatcher = new Dispatcher();

    $eventsManager = new EventsManager();

    #$eventsManager->attach('dispatch',  new Acl);
    $eventsManager->attach('dispatch',  new  Layout());
    $eventsManager->attach('dispatch', new Assets());


    return $dispatcher;

Maybe router are be calling before autoloader, just a look into, because i'm not a zephyr programmer so I can be wrong but thanks for always help!

Linha 210

let router = <RouterInterface> dependencyInjector->getShared("router");

Linha 280


Then register an autoloader outside of registerAutoloaders() in the module to load your routes.

Fine, so I register before the Module.php and not in module.php anymore? thanks andres