定制 selevia/env-validator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

selevia/env-validator

Composer 安装命令:

composer require selevia/env-validator

包简介

The script for validate env variables

README 文档

README

Env Validator is a utility for comparing the expected environment variables (usually defined in a .env.example file) with the actual environment variables (usually loaded from a .env file) that are present at runtime.

Installation

Install via composer:

composer require selevia/env-validator

Usage

As your project grows, your infrastructure concerns change, and so does the .env.example file. Use the env-validator utility to validate that your environment has been configured correctly.

Simply add a script to your composer.json:

{
  "scripts": {
    "env-validator": "env-validator"
  } 
}

and run it:

composer env-validator

or, alternatively, run the executable directly:

vendor/bin/env-validator

Options

By default, the utility looks for .env and .env.example files in the root directory of your project.

If you want to change the default filenames use the following options:

  • --actual (-a) for the actual file.
  • --expected (-e) for the expected file.

Example:

vendor/bin/env-validator --actual=.env.dev --expected=.env.template

Output

The very first line will be a summary of each Status type (i.e. Success, Warning, and Error). Below the summary, all the Error and Warning cases will be outputted, if any.

Statuses

Each environment variable defined in both files will be given a Status

Type Output Message Explanation
Error Expected env var ENV_VAR_NAME was completely missing The variable is missing. This means it was defined in the expected file, but not in the actual one.
Warning Unexpected env var ENV_VAR_NAME encountered The variable is unexpected. This means it was present in the actual file, but it was not defined in the expected file.
Warning Env var ENV_VAR_NAME was present, but the value was empty The variable is blank. This means it was defined in the expected file and present in the actual file, but the value was blank.
Success N/A Everything is okay

统计信息

  • 总下载量: 23
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Copyright
  • 更新时间: 2020-06-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固