Config-reader

Config Reader to parse ini files

View the Project on GitHub jayzeng/config-reader

Config Reader to parse ini files

Latest Stable VersionTotal DownloadsBuild Status

Project website: (http://jayzeng.github.com/config-reader/)

Usage:

config.ini

[production]
username = 'jayzeng'
password = 'password'

[whitelistIps]
ip[] = 127.0.0.1
ip[] = 192.168.0.1/24
use ConfigReader\Ini as IniReader;

// read a specific rule
$username = IniReader::factory( __DIR__ . DIRECTORY_SEPARATOR . 'config.ini' )
                    ->setLabel('production')
                    ->getLabel('username');
                    // returns jayzeng

Read all rules within a label section

use ConfigReader\Ini as IniReader;

// read all rules within production section
$prodConfig = IniReader::factory( __DIR__ . DIRECTORY_SEPARATOR . 'config.ini' )
                    ->setLabel('production')
                    ->toArray();

// returns
// array
// 'username' => 'jayzeng'
// 'password' => 'password'

// You can also populate an array
$ips = IniReader::factory( __DIR__ . DIRECTORY_SEPARATOR . 'config.ini' )
                    ->setLabel('whitelistIps')
                    ->toArray();
// returns
// array
// 'ip' => array ( '127.0.0.1', '192.168.0.1/24' );

Issues & Development

How to release new version?

make release RELEASE_VERSION="0.1" RELEASE_MESSAGE="v0.1 is released"

Author:

Jay Zeng, e-mail: jayzeng@jay-zeng.com