The module’s
manager in ZF2 was written by Evan Coury who described it as “a re-usable piece of functionality
that can be used to construct a more complex application.”
The structure of ZF2 module is as shown below but even
contains more. Normally this would be inside another folder bearing the name of
the folder.
The “config” folder is used for managing
module configuration; the src folder
contains all module source code, including all controllers and models and “view” folder is used to store all the
views used in the module.
ZF2 module
configuration is spread across a series of files which can be found in the
skeleton module. Some of the configuration files are described as follows:-
- Module.php: The Zend Framework 2 module manager looks for the Module.php file in the module's root folder. The module manager uses the Module.php file to configure the module and invokes the getAutoloaderConfig() and getConfig() methods.
- autoload_classmap.php: The getAutoloaderConfig() method in the skeleton module loads autoload_classmap.php to include any custom overrides other than the classes loaded using the standard autoloader format. Entries can be added or removed to the autoload_classmap.php file to manage these custom overrides.
- config/module.config.php: The getConfig() method loads config/module.config.php; this file is used for configuring various module configuration options including routes, controllers, layouts, and various other configurations.
Each module that you write can also provide its own views, layouts,
images, css and JavaScript files, and anything else that
it needs. It can even make use of other modules, so that you only need to write
the minimal amount of code that’s
required. For example we would not bother ourselves writing the
authentication and access control script for our website since there is already
a verity good modules written for that.
To use a third party module you just download it into your vendor folder
and add it to your application configuration file and it would be accessible to
your entire application. I would explain this process in another tutorial just
be patient. This ability to add third party’s module to your own application
helps to quicken the entire design.

No comments:
Post a Comment