Yii 1.1: einihelper

Ini Files Parser Helper Class
1 follower

This simple class may help you to use .INI files on your projects.

IMPORTANTAll helper extensions have been now moved to a more significant repository. Get the most up to date versions from it.


Developed with Yii 1.1.6


Unzip the contents on the package onto your protected/extensions folder. The package has a sample .INI file for testing purposes named settings.ini. For the sake of the example, I assume you have that file.

// Import the library
// path reference to the .INI file
$ini = Yii::getPathOfAlias('ext.helpers').DIRECTORY_SEPARATOR.'settings.ini';
// Load the whole section (please review the example .INI file)
// The static Load method has Singleton functionality
// so only one instance per file is always maintained
$iniF = EIniHelper::Load($ini)->Get('Database');
// echo one of the values
echo $iniF['database'].'<br/>';
// We can also load a single parameter
$iniF = EIniHelper::Load($ini)->Get('Database','dbtype');
echo $iniF.'<br/>';
// Load
$iniF = EIniHelper::Load($ini)->Get('Parameters','webmaster');
echo $iniF.'<br/>';


Change Log


  • 14-02-2011 Initial public release

Be the first person to leave a comment

Please to leave your comment.

Create extension