HomePHP Page 9 - Configuration Manipulation With PHP Config
Link Zone - PHP
Tired of writing (and rewriting) code to manage your application's configuration variables? Take a look at the PEAR Config class, a PHP toolkit designed specifically for manipulating configuration files and the data within them. This article demonstrates using the Config class to read and write configuration files in XML, PHP and INI formats, and use built-in methods to easily build Web-based application configuration modules.
That's about it for the moment. In this article, I introduced you to the Config class, which is designed primarily to assist you in the reading, writing and manipulation of configuration data. I showed you how to read and write configuration files in XML, PHP and INI formats, how to create configuration files from scratch, and how to use Config's built-in methods to simplify and speed up Web-based configuration tool development.
Of course, whatever you've seen over the past few pages is just the top of the iceberg. Config comes with a large number of different methods, allowing you to do all kinds of interesting things like creating configuration sections and variables from scratch, dynamically adding and removing variables from an existing configuration, shifting the positions of sections and variables around within a file, and much more.
If you'd like to learn more about Config and its related tools, you should take a look at the following links:
The Config package on PEAR, at http://pear.php.net/Config
Config API documentation, at http://pear.php.net/manual/en/package.configuration.config.intro.php
The official PEAR Web site, at http://pear.php.net/
Till next time...ciao!
Note: Examples are illustrative only, and are not meant for a production environment. Examples in this tutorial have been tested on Linux/i586 with Apache 1.3.26, PHP 4.2 and Config 1.8. Melonfire provides no warranties or support for the source code described in this article. YMMV!