tnapf / config
v2.0.0
2023-06-05 18:15 UTC
Requires
- php: >=8.1
- psr/simple-cache: ^3
Requires (Dev)
- ergebnis/composer-normalize: ^2.31
- friendsofphp/php-cs-fixer: ^3.16
- mockery/mockery: ^1.5
- phpunit/phpunit: ^10.0
- roave/security-advisories: dev-latest
This package is auto-updated.
Last update: 2024-09-13 17:14:51 UTC
README
简单包,用于处理基于PHP的配置文件。
配置键可用于执行其他PHP文件。请小心,不要在配置键附近信任用户输入。
安装
composer require tnapf/config
使用
/** * -- src * ---- config * ------ database.php * ---- index.php */ # src/config/database.php return [ 'host' => 'localhost', 'name' => 'my_database', 'port' => 1337, ]; # src/index.php $config = new Tnapf\Config\Config( new \Tnapf\Config\ConfigProvider\PhpBackedConfigProvider(__DIR__ . '/config') ); $config->get('database.host', 'my-default-value'); // 'localhost'
要求
- PHP 8.1+