A simple INI file reader.
composer require kiryi/inyi
$inyi = new \Kiryi\Inyi\Reader($filepath);
$value = $inyi->get($key);
__construct(string $filepath)
filepath
The filepath to your INI file. It is relative to your project's root directory.
get(string $key)
key
The key to read the value from the INI file. Key levels are seperated by double colons.
Returns the value corresponding to the key. Since it is possible to define strings as well as arrays in an INI file, the return type can be either. If the key is not defined or the INI file is broken or non existing, an exception is thrown.
configuration/config.ini
[database]
user = kiryi
password = qwe123
src/Config.php
(new \Kiryi\Inyi\Reader('configuration/config.ini'))->get('database::user');
returns
kiryi