Caution: The documentation you are viewing is
for an older version of Zend Framework.
You can find the documentation of the current version at:
The Factory — Zend Framework 2 2.0.7 documentation
The factory gives you the ability to load a configuration file to an array or to Zend\Config\Config object. The factory has two purposes
Storing the configuration will be done to one file. The factory is not aware of merging two or more configurations and will not store it into multiple files. If you want to store particular configuration sections to a different file you should separate it manually.
The next example illustrates how to load a single configuration file
1 2 3 4 5
//Load a php file as array $config = Zend\Config\Factory::fromFile(__DIR__.'/config/my.config.php'); //Load a xml file as Config object $config = Zend\Config\Factory::fromFile(__DIR__.'/config/my.config.xml', true);
For merging multiple configuration files
Sometimes you want to store the configuration to a file. Also this is really easy to do