HomePHP Page 3 - Easy Application Configuration With patConfiguration
Your Friendly Neighbourhood Spiderman - PHP
Tired of handcrafting configuration file manipulation tools for your Web application? Save yourself some time with patConfiguration, a PHP class designed to assist developers with reading, writing and maintaining application configuration files.
The XML file above contains configuration data in a format that is understood
by patConfiguration. As you can see, a patConfiguration-compliant configuration file must conform to the standard rules of XML markup, and must contain a <configuration> root element. Configuration values can be grouped together under this root element using <path> elements, with every variable-value pair represented by a <configValue> element.
Variable-value pairs are accessed by drilling down the tree of <path> elements until the desired node is reached. For example, to access the value of the email address
spider.man@roof.top.com
in the configuration file above, I would use the path
mail.from-address.
patConfiguration allows you to nest <path> elements to any depth - the following
is a perfectly valid configuration file:
You can even link the values in a configuration file with each other via the
<getConfigValue> element - consider the following example, which uses the application name and version number to dynamically create a variable containing the window title:
The variable-value pairs in this configuration file can be read and manipulated
by patConfiguration in the context of a PHP application. Let's look at that next.