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
Note
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
The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.