Injecting dependencies into your ZF2 controllers
When starting working with Zend Framework 2, it's common to copy the skeleton and put your controller definitions in module.config.php like this: 'controllers' => array( 'invokables' => array( 'Application\Controller\Index' => 'Application\Controller\IndexController', 'Application\Controller\Blog' => 'Application\Controller\BlogController', ), ), The controllers keyword is picked up by the ControllerManager which is an instance of the ServiceManager which means that it creates the controller instance for you when the dispatcher needs it.