# Zend_Application_Resource_Modules

`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:

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

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

    $options = 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).

## 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.

    [production]
    news.resources.db.adapter = "pdo_mysql"
    news.resources.db.params.host = "localhost"
    news.resources.db.params.username = "webuser"
    news.resources.db.params.password = "XXXXXXX"
    news.resources.db.params.dbname = "news"

    <?xml version="1.0"?>
    <config>
        <production>
            <news>
                <resources>
                    <db>
                        <adapter>pdo_mysql</adapter>
                        <params>
                            <host>localhost</host>
                            <username>webuser</username>
                            <password>XXXXXXX</password>
                            <dbname>news</dbname>
                        </params>
                        <isDefaultAdapter>true</isDefaultAdapter>
                    </db>
                </resources>
            </news>
        </production>
    </config>

## 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.

    $resource = $bootstrap->getPluginResource('modules');
    $moduleBootstraps = $resource->getExecutedBootstraps();
    $newsBootstrap = $moduleBootstraps['news'];