Zend Framework Modular Design

This is an old post , please refer to the new one here .
In this tutorial , I will show you how to make a module based web application using zend framework .

Application Structure 

This is the default application structure for a zend framework web application .
The simple change you can see is modules directory inside application directory , which will contain the different modules of your application
- application
- configs
- controllers
- modules
- views
- Bootstrap.php
- library
- public

Module Structure
Inside modules directory you will put a directory for each module you will make .
I will make an admin module so my modules directory will be like the following .
- configs
- controllers
- modules
- admin
- views
- Bootstrap.php

Here is the configuration you should put to enable modules structure in your zend framework application.
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules[] =

And this is the main Bootstrap file

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {

    protected function _initAppAutoload() {
        $autoloader = new Zend_Application_Module_Autoloader(array(
                    'namespace' => 'Default',
                    'basePath' => dirname(__FILE__),
        return $autoloader;
Module Bootstrap.php
And this is bootstap file of the admin module

class Admin_Bootstrap extends Zend_Application_Module_Bootstrap {

Pay attention that this class extends Zend_Application_Module_Bootstrap file not Zend_Application_Bootstrap_Bootstrap like the main bootstrap file .

Module Controller
This is an example of controller in the module

class Admin_IndexController extends Zend_Controller_Action {

    public function init() {
        /* Initialize action controller here */

    public function indexAction() {