Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Zend Framework Blog:
zend-config For All Your Configuration Needs
Feb 23, 2017 @ 16:25:13

The Zend Framework blog has a new post from Matthew Weier O'Phinney focusing on another useful component of the framework, the zend-config component. This component, already in wide use across the framework, allows for flexible configurations to be defined and easily consumed for your use.

Different applications and frameworks have different opinions about how configuration should be created. Some prefer XML, others YAML, some like JSON, others like INI, and some even stick to the JavaProperties format; in Zend Framework, we tend to prefer PHP arrays, as each of the other formats essentially get compiled to PHP arrays eventually anyways.

At heart, though, we like to support developer needs, whatever they may be, and, as such, our zend-config component provides ways of working with a variety of configuration formats.

He walks you through the installation of the component (via Composer) and the dependencies it requires. The post then moves on to the use of the component to get configuration values from a single or multiple files (.php, .ini, .json, etc). It also covers the optional return of the values as objects, making them read-only, including your own configurations and using alternative parsers (like Symfony's YAML component). It ends with a look at some of the configuration options you can give the component including the addition of processors to manipulate values once they're read.

tagged: zendframework zendconfig component spotlight tutorial

Link: https://framework.zend.com/blog/2017-02-22-zend-config.html


Trending Topics: