PHP Classes

Advanced INI file: Read and parse INI files with multiple levels

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 501 All time: 5,809 This week: 89Up
Version License PHP version Categories
advanced-ini-file 9Custom (specified...5.6PHP 5, Configuration, Parsers
Description 

Author

This class can read and parse INI files with N levels.

It can read and parse a given INI file and build an associative array with entries for each section and each variable value.

Sections with names with colons : are returned as multiple levels of the associative array, for instance [ abc:def ] will be returned as

$var['abc']['def'] = values;

Variable names such as a.b.c and a:b:c will be expanded into sub-levels, such as:

['a']['b']['c'] = value;

It also supports variable substitution using values of certain settings to define other settings such as:

root = "/mnt/some/path"
logs.access = "{root}/access_log"

It has now been updated with the following extensions:

#include <filename> Includes the file <filename>
#define <name> <value> Defines the constant <name> to be <value>
#iniset <name> <value> Sets the ini parameter <name> to be <value>

Includes can be N-level.

Innovation Award
PHP Programming Innovation award nominee
August 2015
Number 4


Prize: One copy of the Zend Studio
INI files are used to store configuration values. Usually they are divided in sections and each section may have multiple configuration values.

This class extends the structure of INI functions but allowing to have sub-sections and sub-variables by considering : or . characters in the section or variable names as separators.

This away the class can return nested arrays that contain sub-sections or sub-variables and children arrays, which are much easier to process by applications.

Manuel Lemos
Picture of Chris Sprucefield
  Performance   Level  
Name: Chris Sprucefield is available for providing paid consulting. Contact Chris Sprucefield .
Classes: 2 packages by
Country: Malta Malta
Age: ???
All time rank: 29592 in Malta Malta
Week rank: 180 Up1 in Malta Malta Up
Innovation award
Innovation award
Nominee: 1x

  Files folder image Files (4)  
File Role Description
Accessible without login Plain text file Example.txt Doc. Examples
Plain text file Inifile.inc Class Inifile class
Accessible without login Plain text file license.txt Lic. licencse.txt
Accessible without login Plain text file sample.ini Example Sample ini file

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:501
This week:0
All time:5,809
This week:89Up