Login   Register  
PHP Classes
elePHPant
Icontem

ezphpconfig

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

  Author  
Picture of David Wainwright
Name: David Wainwright <e-mail contact>
Packages: 1 Browse all classes by David Wainwright Browse all classes by
Country: United Kingdom United Kingdom - PHP jobs in United Kingdom
Age: 39
All time rank: 189483 in United Kingdom United Kingdom
Week rank: 2190 Down87 in United Kingdom United Kingdom Down
Innovation award
Innovation award
Nominee: 1x


  Detailed description   Download .zip .tar.gz  
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.

  Classes of David Wainwright  >  ezphpconfig  >  Download .zip .tar.gz  >  Support forum Support forum (1)  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: ezphpconfig
Base name: ezphpconfig
Description: Converts xml config file into a set of php classes
Version: 0.4
PHP version: 5
License: GNU General Public License (GPL)
All time users: 1114 users
All time rank: 2939
Week users: 0 users
Week rank: 2071 Equal
 
  Groups   Freshmeat project   Rate classes User ratings   Applications   Files Files  

  Groups  
Group folder image XML XML parsing and generation View top rated classes
Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Code Generation Compilers and tools that generate code automatically View top rated classes
Group folder image Configuration Configuration formats parsing and generation View top rated classes


  Innovation Award  
PHP Programming Innovation award nominee
April 2008
Number 8

Prize: One book of choice by Packt
XML is often used by humans to store information that can easily be parsed by computer programs, like for instance application configuration options.

However, XML parsing is often a process that consumes too much CPU and memory when parsing many documents or the same document many times.

This class provides a solution to override the overhead of repeatedly parsing XML configuration files. It creates a PHP class file with variables set to the configuration values retrieved from the XML file.

This way the XML file does not have to be parsed in all requests on which its information is needed. The speedup can be further optimized by using a PHP caching engine extension, as the generated PHP class does not need to be parsed and compiled again.

Manuel Lemos

  Freshmeat project  
Project record: ezphpconfig
Popularity score: 11.45
Vitality score: 1.0

  User ratings  
There are not enough user ratings to display for this class.

  Applications that use this class  
No application links were specified for this class.
Add link image If you know an application of this package, send a message to the author to add a link here.
  Files folder image Files  
File Role Description
Accessible without login Plain text file config.xml Doc. example config file
Plain text file ConfigurationLoader.class.php Class class file
Accessible without login Plain text file COPYING Lic. license
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file example.xml Data example xml file
Accessible without login Plain text file README Doc. Setup Instructions

Download all files: ezphpconfig.tar.gz ezphpconfig.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.