jayzeng/config-reader

Ini config reader for PHP 5.3

v0.1 2013-02-03 22:34 UTC

This package is not auto-updated.

Last update: 2024-12-15 03:43:02 UTC


README

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?

  • RELEASE_VERSION - version number
  • RELEASE_MESSAGE - release message
make release RELEASE_VERSION="0.1" RELEASE_MESSAGE="v0.1 is released"

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

Bitdeli Badge