I have a questiom regarding the Zend Framework 2:
I have
library/System and library/Zend. the system is my custom library, which I want to configure de aplication (routes, modules, etc., and redirect user to correct module, controller and/or action).
I don’t want to do this inside each application/modules/ModuleName/Module.php file. So, my library/System can do everything related to application configuration.
As said in the comments above: register to the bootstrap-event and add new routes there:
$app = $e->getParam('application');does return an instance ofZend\Mvc\Application. Have a look there to see which additional parts you can get there. Thebootstrapevent is fired before the actual dispatching does happen.Note that the ZendFramework 1 routes are not always compatible to the ZendFramework 2 ones.
Update to comments
Update to new question
This only happens in one zf2 module (named
Applicationwhich can be the only one as well). This doesn’t fit your needs? You could: