Development Blog With Code Updates : Developercast.com

May 30, 2008

Eirik Hoem’s Blog: Simple config management for PHP

Filed under: Development — @ 8:54 am

In a new post to his blog today, Eirik Hoem gives an example of using the parse_ini_file function to work with .ini files as configuration for your application.

When doing complex applications it’s often nice to have some sort of system for handling settings. PHP has a nice function called parse_ini_file which can be used to create a basic but still usable setting file feature. A simple class which loads the configuration file and offers some methods to retrieve the values for a given key is all that’s needed.

His example code gives a sample ini file with database connection information and a MyConfigClass that parses the file and can get or set values in it.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress