arwg / env-knife
一个从源代码中提取和验证 env-functions(如 env(),config())的库。
v0.0.4
2021-02-23 13:48 UTC
Requires
- php: >=7.2
Requires (Dev)
- php-coveralls/php-coveralls: ^2.2
- phpunit/phpunit: ^8.5.8|^9.3.3
- vimeo/psalm: ^4
This package is not auto-updated.
Last update: 2024-10-02 17:01:57 UTC
README
概览
一个从源代码中提取和验证 env-functions(如 env(),config())的库
安装
composer require arwg/env-knife
使用方法
简单易用。输入在源代码中用于加载环境变量的函数名称。需要注意的是,不需要进行键值设置。
$envKnife = new EnvKnife(); // For the first parameter, you can set any function name you are using for loading environment variables. // Detect funcs such as env('URL'), env("APP_CRITICAL", 5) // !! Variable types are limited to 'string, numeric, boolean' $envKnife->parseResults('env', base_path(), ['app', 'bootstrap', 'config', 'routes']); // Detect when 'env('URL') returns null' $results = $envKnife->getEmptyResults(); // Detect funcs such as config('abc'), config("ABC_CRITICAL", 5) // !! Variable types are limited to 'string, numeric, boolean' $envKnife->parseResults('config', base_path(), ['app', 'bootstrap', 'config']); $results = $envKnife->getEmptyResults(); // Detect errors such as "undefined index 'c'" in config('abc')['v']['c'] in case that there is no 'c'. $results2 = $envKnife->getErrorResults();