Ini file configuration engine.
Since IniConfig uses parse_ini_file underneath, you should be aware that this class shares the same behavior, especially with regards to boolean and null values.
In addition to the native parse_ini_file
features, IniConfig also allows you to create nested array structures through usage of .
delimited names. This allows you to create nested arrays structures in an ini config file. For example:
db.password = secret
would turn into ['db' => ['password' => 'secret']]
You can nest properties as deeply as needed using .
's. In addition to using .
you can use standard ini section notation to create nested structures:
[section] key = value
Once loaded into Configure, the above would be accessed using:
`Configure::read('section.key');
You can combine .
separated values with sections to create more deeply nested structures.
IniConfig also manipulates how the special ini values of 'yes', 'no', 'on', 'off', 'null' are handled. These values will be converted to their boolean equivalents.
$_extension
protected string
$_section
protected string|null
Build and construct a new ini file parser. The parser can be used to read ini files that are on the filesystem.
__construct( string|null $path null , string|null $section null )
Build and construct a new ini file parser. The parser can be used to read ini files that are on the filesystem.
$path
optional null $section
optional null Only get one section, leave null to parse and fetch all sections in the ini file.
_parseNestedValues( array $values )
parses nested values out of keys.
$values
_value( mixed $value )
Converts a value into the ini equivalent
$value
dump( string $key , array $data )
Dumps the state of Configure data into an ini formatted string.
$key
The identifier to write to. If the key has a . it will be treated as a plugin prefix.
$data
Cake\Core\Configure\ConfigEngineInterface::dump()
read( string $key )
Read an ini file and return the results as an array.
$key
The identifier to read from. If the key has a . it will be treated as a plugin prefix. The chosen file must be on the engine's path.
Cake\Core\Exception\Exception
when files don't exist. Or when files contain '..' as this could lead to abusive reads.
Cake\Core\Configure\ConfigEngineInterface::read()
_getFilePath( string $key , boolean $checkExists false )
Get file path
$key
The identifier to write to. If the key has a . it will be treated as a plugin prefix.
$checkExists
optional false Cake\Core\Exception\Exception
When files don't exist or when files contain '..' as this could lead to abusive reads.
© 2005–2017 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.4/class-Cake.Core.Configure.Engine.IniConfig.html