PHP Classes
elePHPant
Icontem

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

Recommend this page to a friend!
  Info   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2016-05-19 (5 months ago) RSS 2.0 feedNot enough user ratingsTotal: 392 All time: 6,279 This week: 1,042Up
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 <contact>
Classes: 2 packages by
Country: Malta Malta
Innovation award
Innovation award
Nominee: 1x

  Files folder image Files  
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

 Version Control Unique User Downloads Download Rankings  
 0%
Total:392
This week:0
All time:6,279
This week:1,042Up