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 also use .
separated values in section names 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.
string
File extension.
string
The path this engine finds files on.
string|null
The section to read, if null all sections will be read.
Build and construct a new ini file parser. The parser can be used to read ini files that are on the filesystem.
Get file path
parses nested values out of keys.
Converts a value into the ini equivalent
Dumps the state of Configure data into an ini formatted string.
Read an ini file and return the results as an array.
__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.
string|null
$path optional Path to load ini config files from. Defaults to CONFIG.
string|null
$section optional Only get one section, leave null to parse and fetch all sections in the ini file.
_getFilePath(string $key, bool $checkExists = false): string
Get file path
string
$key The identifier to write to. If the key has a . it will be treated as a plugin prefix.
bool
$checkExists optional Whether to check if file exists. Defaults to false.
string
Cake\Core\Exception\CakeException
_parseNestedValues(array $values): array
parses nested values out of keys.
array
$values Values to be exploded.
array
_value(mixed $value): string
Converts a value into the ini equivalent
mixed
$value Value to export.
string
dump(string $key, array $data): bool
Dumps the state of Configure data into an ini formatted string.
string
$key The identifier to write to. If the key has a . it will be treated as a plugin prefix.
array
$data The data to convert to ini file.
bool
read(string $key): array
Read an ini file and return the results as an array.
This method is used for reading configuration information from sources. These sources can either be static resources like files, or dynamic ones like a database, or other datasource.
string
$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.
array
Cake\Core\Exception\CakeException
File extension.
string
The path this engine finds files on.
string
The section to read, if null all sections will be read.
string|null
© 2005–present 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/4.4/class-Cake.Core.Configure.Engine.IniConfig.html