charm/config

配置中心。用于访问配置信息。

0.0.3 2021-09-09 21:39 UTC

This package is not auto-updated.

Last update: 2024-09-14 11:25:32 UTC


README

一个具有偏见且简单的库,用于检索项目配置值。

用法

配置值通过字符串名称标识。

示例:Charm\Config::get('database host') 将尝试在以下位置查找值

1.	The constant `\DATABASE_HOST`.
	Configuration constants are by convention uppercase, so the provided identifier is converted before
	we look for the constant.

2.	The constant `\DATABASE`.
	If this constant exists and it is a PHP array, we will look for the 'host' key in the array.

3.  The environment variable `DATABASE_HOST`
    Environment variables follow the same uppercase convention as constants.

4.  The environment variable `DATABASE`; if found it is JSON-decoded and then we look for the 'host' key.

5.  The `config/` folder located together with the `composer.json` file; looking for a file named `config/database.php`.
    The file should be a normal PHP file which returns an array.