kiryi/inyi

Simple INI file reader.

1.0.2 2020-04-23 23:59 UTC

This package is auto-updated.

Last update: 2024-06-24 08:47:59 UTC


README

Kiryi's INYI

A simple INI file reader.

Installation

composer require kiryi/inyi

Usage

$inyi = new \Kiryi\Inyi\Reader($filepath);
$value = $inyi->get($key);

Constructor Definition

__construct(string $filepath)

Parameters

filepath
The filepath to your INI file. It is relative to your project's root directory.

Method Definition get

get(string $key)

Parameters

key
The key to read the value from the INI file. Key levels are seperated by double colons.

Return Values

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.

Example

configuration/config.ini

[database]
user = kiryi
password = qwe123

src/Config.php

(new \Kiryi\Inyi\Reader('configuration/config.ini'))->get('database::user');

returns

kiryi