teun/laravel-environment-config-validator 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

teun/laravel-environment-config-validator

最新稳定版本:v1.0.0

Composer 安装命令:

composer require teun/laravel-environment-config-validator

包简介

Validate Laravel environment variables against configurable rules.

README 文档

README

Validate Laravel environment variables against rules you define in config.

Installation

composer require teun/laravel-environment-config-validator

Publish the config file:

php artisan vendor:publish --tag=env-validator-config

Configuration

Set rules in config/env-validator.php:

return [
    'preset' => 'standard', // standard | strict | custom | your-own-preset-key
    'env_file' => null, // null = runtime env, or set '.env.testing'

    'presets' => [
        'standard' => [
            // built-in default Laravel-oriented rules
        ],
        'strict' => [
            // built-in stricter production-focused rules
        ],
        'my-team' => [
            'APP_ENV' => ['required', 'in:staging,production'],
            'DB_PASSWORD' => ['required', 'string'],
        ],
    ],

    // Overrides selected preset keys. If preset=custom, this is the full ruleset.
    'rules' => [
        'APP_ENV' => ['required', 'in:local,staging,production'],
    ],

    'check_env_example' => true,
];

Usage

Run validation:

php artisan env:validate

Override preset at runtime:

php artisan env:validate --preset=strict

Validate a specific file (for example .env.testing):

php artisan env:validate --env-file=.env.testing

Machine-readable output:

php artisan env:validate --json

Fail CI when .env.example is missing required keys:

php artisan env:validate --strict-example

CI example

php artisan env:validate --strict-example

Use this command in your deployment or CI pipeline to fail early on invalid environment config.

Testing

composer test

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固