marella/phig

PHP Config library.

v0.0.1 2016-03-19 08:14 UTC

This package is not auto-updated.

Last update: 2024-04-24 21:13:57 UTC


README

Coverage Status Build Status StyleCI Latest Stable Version Total Downloads Latest Unstable Version License

PHP Config Library.

Quick Usage

composer require marella/phig
<?php

require 'vendor/autoload.php';

$loader = new \Phig\ConfigLoader();
$config = $loader->read(__DIR__.'/config');

$timezone = $config['app.timezone']; // 'UTC'
$locale = $config['app']['locale']; // 'en'
$database = $config['database']; // array
$host = $database['host']; // 'localhost'

where config directory contains these files:

app.php

<?php

return [
    'timezone' => 'UTC',
    'locale' => 'en',
];

database.php

<?php

return [
    'host' => 'localhost',
    'database' => 'forge',
    'username' => 'forge',
    'password' => '',
];

Documentation

See the wiki for more details and documentation.

Contributing

See contributing guidelines before creating issues or pull requests.

License

Open-source software released under the MIT license.