Recommend this page to a friend!
  Classes of Stefan Kientzler  >  PHP Config Class  >  >  Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: PHP Config Class
Read configuration from JSON, INI, XML and arrays
Author: By
Last change:
Date: 2 months ago
Size: 2,082 bytes


Class file image Download

Read configuration files of different formats (INI, JSON, XML,...)

Latest Stable Version License Donate Minimum PHP Version Scrutinizer Code Quality


This package provides a general interface that grant access to configuration settings of different sources and/or formats.

Following Formats are supported so far:

  • JSON
  • INI (flat INI file like 'usual' windwos INI-Files supporting sections and entries)
  • XML
  • directly from an Array (content may result from a DB query)

In addition, the package offers the possibility of merging several configurations from different sources and / or in different formats into one object, which can then be used by any module.

There is thus the possibility of e.g. Merge global and local or general and user-specific configurations without the processing module having to know where what information comes from.

A NullConfig class is also included that can be used for testing. Also this class can be used if it is desired to make a module working completly independent with default configuration values and optional can have external configuration be passed.


  1. Create an instance of the class that supports the desired format.
  2. Pass this instance to any module that supports the `ConfigInterface`
  3. inside the module get the needed config settings with `the getXXX($strPath, $default)` - Methods

See ConfigExample.php

For the format of the configuration files see the seeral examples comming with this package.


2021-01-05 Version 1.00

* initial Version

For more information send a message to info at phpclasses dot org.