PHP Classes

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    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 500 All time: 5,812 This week: 455Up
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: 29562 in Malta Malta
Week rank: 321 Up1 in Malta Malta Up
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:500
This week:0
All time:5,812
This week:455Up