Skip to content

marella/phig

Repository files navigation

Phig

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.