phico/config

Lightweight config file reader for Phico

dev-main 2024-07-17 10:01 UTC

This package is auto-updated.

Last update: 2024-11-17 10:35:27 UTC


README

Lightweight config support Phico

Installation

Using composer

composer require phico/config

Usage

Create a config file

// /config/apis.php

return [
    'example' => [
        'url' => 'https://api.example.com',
        'secret' => 'top-secret'
    ]
];

Fetch a defined value

echo config()->get('apis.example.secret');
//  top-secret

Return a default value if the config is missing

echo config()->get('apis.example.missing', 'abc-123');
//  abc-123

Issues

Config is considered feature complete, however if you discover any bugs or issues in it's behaviour or performance please create an issue, and if you are able a pull request with a fix.

Please make sure to update tests as appropriate.

For major changes, please open an issue first to discuss what you would like to change.

License

BSD-3-Clause