IF AN EXPERT SAYS IT CAN'T BE DONE GET ANOTHER EXPERT.- DAVID BEN-GURION

Zend Framework - Working with Modules

Zend Framework has much more power then you really know, and today we
will talk about Zend Framework working with modules.

Lets just start:

How we define modules and why we need them?

Modules are very important, fully power and useful tool. As I see it,
its helps us to create mini-application inside our main application.
While using our module, we have the ability to use its power on our main
application and to replace it any time we want without hurting our code.
Another important issue is the ability of flexibility which means that
we can detach our module from one program and use it on another program.

While creating modules you need to know few things which will help you
to start fast.

For creating new module with zf tool, use the following command:

zf create module name, e.g: zf create module Users.

Note: Before using this command, you will have to be on your project (ZF) directory, e.g:

cd /var/www/html/skoproject/ | zf create module Users

Know your enemy ;). Its important to know modules folder structure which you can see here.
Note that you can use controllers/ folder as well. Full folder structure will be:

When using modules, you probably should know that you have some "default" module that surprisingly will called "Default"

While using your module, you will have to know files & classes
syntax. All of your classes will be:
ModuleName_DirectoryName_FileName, for example, when you are
working with Users module, on Register form you will
use:Users_Form_Register and you will find this class under:
APPLICATION_PATH . '/modules/users/forms/Register.php'

When working with "Default" module, you won't have to name your classes with ModuleName, which means that you will work with:

Form_Register under APPLICATION_PATH .
'/modules/default/forms/Register.php'.I still advice to use your
naming convention the same as the others.

You may use different configuration file for your module instead of
your main application config file.
Use it under APPLICATION_PATH .
'/modules/ModuleName/config/application.ini , and don't forget to
init your settings inside the module's Bootstrap.php

To sum-up, I`v read some helpful articles about Zend Framework and
modules, and I think you should read them as well: