This configuration system is based on default runtime configuration system.
Difference consists in SAPI access: PHP alone supports .user.ini files only using CGI/FastCGI SAPI, using this version custom configurations can be setted outside main php.ini.
Suppose to use this project structure
www/
app/
.user.ini
foo.php
configuration.php
.user.ini
Configuration files are
; www/app/.user.ini
precision = 13
custom.setting = bar
; www/.user.ini
precision = 12
An application file is
<?php
// www/app/foo.php
var_dump(ini_get('precision')); // 14
var_dump(ini_get('custom.setting')); // false
var_dump(getenv('custom.setting')); // false
require_once 'configuration.php';
// Will be loaded:
// 1. www/app/.user.ini
// 2. www/.user.ini
var_dump(ini_get('precision')); // 12
var_dump(ini_get('custom.setting')); // false
var_dump(getenv('custom.setting')); // "bar"
Currently the precedence is defined by .ini file position in the directories structure, more external means more importance.