Caution: The documentation you are viewing is
for an older version of Zend Framework.
You can find the documentation of the current version at:
Introduction to the Module System — Zend Framework 2 2.4.9 documentation
The module system in ZF2 has been designed to be a generic and powerful foundation from which developers and other projects can build their own module or plugin systems.
For a better understanding of the event-driven concepts behind the ZF2 module system, it may be helpful to read the EventManager documentation.
The module system is made up of the following:
The name of a module in a typical Zend Framework 2 application is simply a PHP namespace and must follow all of the same rules for naming.
The recommended structure of a typical MVC-oriented ZF2 module is as follows:
module_root/ Module.php autoload_classmap.php autoload_function.php autoload_register.php config/ module.config.php public/ images/ css/ js/ src/ <module_namespace>/ <code files> test/ phpunit.xml bootstrap.php <module_namespace>/ <test code files> view/ <dir-named-after-module-namespace>/ <dir-named-after-a-controller>/ <.phtml files>
The three autoload_*.php files are not required, but recommended. They provide the following:
The purpose of these three files is to provide reasonable default mechanisms for autoloading the classes contained in the module, thus providing a trivial way to consume the module without requiring Zend\ModuleManager (e.g., for use outside a ZF2 application).