imunhatep/checkenv
最新稳定版本:v1.0.3
Composer 安装命令:
composer require imunhatep/checkenv
包简介
General-Purpose Library for PHP
README 文档
README
Compares application environment variables against .env file. It could be useful on InitContainer stage to validate cluster settings for PHP application deployment.
Based on Symfony/Console component,
Installation:
composer require imunhatep/checkenv
Usage example:
cd ./bin ln -s ../vendor/imunhatep/checkenv/bin/check-env cd .. ./bin/check-env c:c:e --dot-env=".env.dist"
Note: by default Symfony4 loads .env on every application invoke, check your project config/bootstrap.php:
Fix for config/bootstrap.php, to skip loading .env in case APP_ENV variable is defined.
#... // Load cached env vars if the .env.local.php file exists // Run "composer dump-env prod" to create it (requires symfony/flex >=1.2) if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) { foreach ($env as $k => $v) { $_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && 0 !== strpos($k, 'HTTP_') ? $_SERVER[$k] : $v); } } elseif (!class_exists(Dotenv::class)) { throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.'); } elseif (getenv('APP_ENV') === false) { // load all the .env files (new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env'); } #...
Added check: } elseif (getenv('APP_ENV') === false) {
统计信息
- 总下载量: 24.32k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2019-10-08