ZF-6719: Allow multiple configs

Issue Type: New Feature Created: 2009-05-18T18:31:53.000+0000 Last Updated: 2010-11-27T16:13:51.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Sebastian Krebs (kingcrunch) Assignee: Jon Whitcraft (sidhighwind) Tags: - Zend_Application

Related issues: - ZF-10752

Attachments: - ZF6719.patch


Currently there is only one configuration file. It would be nice, if its possible to combine more.

An example: The prefered way is to set up the configuration under "configs/application.*". So there could be others, something like "configs/navigation.*", which would be the configuration for the navigation-resource-plugin. Or it will be the configuration for the module "navigation" and the config for the navigation-resource-plugin resist under "configs/resources/navigation.*"

One other possibility is, that a module can carry its own configuration at "modules/name/configs/bla.*". As mentioned in the project-structure-proposal [1] the modules mimic the default structure, so the "configs"-directory is included. This should be used somewhere... ;)



Posted by Christoph Ziegenberg (ziegenberg) on 2009-06-04T01:30:55.000+0000

What about using an array for the 'config' option:

<pre class="highlight">
$application = new Zend_Application(
        'config' => array (
            APPLICATION_PATH . '/configs/database.ini',
            APPLICATION_PATH . '/configs/application.ini'

and change the setOption method in Zend_Application from

<pre class="highlight">
        if (!empty($options['config'])) {
            $options = $this->mergeOptions($options, $this->_loadConfig($options['config']));


<pre class="highlight">
        if (!empty($options['config'])) {
            if (is_array($options['config'])) {
                foreach ($options['config'] as $tmp){
                    $options = $this->mergeOptions($options, $this->_loadConfig($tmp));
            } else {
                $options = $this->mergeOptions($options, $this->_loadConfig($options['config']));

Posted by Jon Whitcraft (sidhighwind) on 2009-11-19T14:37:27.000+0000

Attached is my proposed patch, if this is accepted it would be only to the trunk as another change that was made with ZF-6811.

Posted by Jon Whitcraft (sidhighwind) on 2009-11-20T09:40:38.000+0000

This has been fixed and will be part of 1.10 as ZF-6811 was put into place before and was flaged for 1.10 since it introduces a BC break.

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.