you mean, i should build micro application on top of my multi-mvc app?
I don't want to move routing logic into controllers...
And don't think it somehow related to generating urls...
Maybe, i misstell my task.
What i really want is something like ability to define which module should take care of request before loading a module:
index.php:
$config = include __DIR__ . "/../var/config/config.php";
include __DIR__ . "/../var/config/loader.php";
include __DIR__ . "/../var/config/services.php";
$di->set('router', function(){
$oRouter = new Router();
$oRouter->add('/api/.*', array(
'module' => 'Api'
));
$oRouter->add('/regular/.*', array(
'module' => 'Regular'
));
return $oRouter;
});
$application = new \Phalcon\Mvc\Application($di);
$application->registerModules(array(
'regular' => array(
'className' => 'Modules\Regular\Module',
'path' => '../app/modules/regular/Module.php',
),
'api' => array(
'className' => 'Modules\Api\Module',
'path' => '../app/modules/api/Module.php',
),
));
echo $application->handle()->getContent();
...comments in code seemed to brake all the markdown, so i get rid of it.
And than somehow add concrete routes in Module.php of corresponding module