Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...

When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store


Zend_Application_Resource_Modules is used to initialize your application modules. If your module has a Bootstrap.php file in its root, and it contains a class named Module_Bootstrap (where "Module" is the module name), then it will use that class to bootstrap the module.

By default, an instance of Zend_Application_Module_Autoloader will be created for the module, using the module name and directory to initialize it.

Since the Modules resource does not take any arguments by default, in order to enable it via configuration, you need to create it as an empty array. In INI style configuration, this looks like:

resources.modules[] =

In XML style configuration, this looks like:

        <!-- Placeholder to ensure an array is created -->
        <placeholder />

Using a standard PHP array, simply create it as an empty array:

= array(
'resources' => array(
'modules' => array(),

Front Controller Resource Dependency

The Modules resource has a dependency on the Front Controller resource. You can, of course, provide your own replacement for that resource via a custom Front Controller resource class or a class initializer method -- so long as the resource plugin class ends in "Frontcontroller" or the initializer method is named "_initFrontController" (case insensitive).

Example 43. Configuring Modules

You can specify module-specific configuration using the module name as a prefix or sub-section in your configuration file.

For example, let's assume that your application has a "news" module. The following are INI and XML examples showing configuration of resources in that module.

news.resources.db.adapter = "pdo_mysql" = "localhost"
news.resources.db.params.username = "webuser"
news.resources.db.params.password = "XXXXXXX"
news.resources.db.params.dbname = "news"
<?xml version="1.0"?>

Example 44. Retrieving a specific module bootstrap

On occasion, you may need to retrieve the bootstrap object for a specific module -- perhaps to run discrete bootstrap methods, or to fetch the autoloader in order to configure it. This can be done using the Modules resource's getExecutedBootstraps() method.

$moduleBootstraps $resource->getExecutedBootstraps();
$newsBootstrap $moduleBootstraps['news'];

Zend Framework