PHP Classes

Classes of David Wainwright

Recommend this page to a friend!
  All class groups  >  All authors  >  Classes of David Wainwright (1)  >  Mission progress status  >  Reputation  
Picture of David Wainwright
Name: David Wainwright <contact>
Classes: 1
Country: United Kingdom
Age: 50
All time rank: 211795 in United Kingdom
Week rank: 227 Up14 in United Kingdom Up
All time users: 1204
Week users: 0
Innovation award
Innovation award
Nominee: 1x
 
  A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z  
  Files folder image ezphpconfig  
PHP Programming Innovation award nominee
April 2008
Number 8


Prize: One book of choice by Packt
Converts xml config file into a set of php classes
Generates a set of php configuration classes from a supplied xml file. You can then access your configuration values very quickly without having to parse the xml file on every request.

This class can be used to generate a PHP class from an XML file. The element (tag) names become property names and the text contained in the elements becomes the property's value. It also supports nested elements.

If the generated php file is older than the xml file, it is re-generated using the data in the newer xml file.

For example, this xml file:
<config>
<database>
<connString>This is my connection string</connString>
</database>
</config>

Would be accessed in php as follows (after the ConfigurationLoader.update method had been called:
$config = new config();
echo $config->database->connString;

This class also supports array types using the <item> element inside an element whose type attribute is set to "array". Please read the documentation and see example xml files for more details.

Once you have your configuration classes you can get or set the values as required.
RatingsUtility Consistency Documentation Examples Tests Videos Overall Rank
All time: 75% 68% 68% 68% - - 58% 1551
Month: Not yet rated by the users


  A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z