PHPackages                             shahghasiadil/laravel-env-validator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. shahghasiadil/laravel-env-validator

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

shahghasiadil/laravel-env-validator
===================================

A Laravel package to validate environments variables configuration values and generate environments variables rules.

v1.0.2(1y ago)113MITPHPPHP ^7.3|^8.0|^8.2

Since Sep 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/shahghasiadil/laravel-env-validator)[ Packagist](https://packagist.org/packages/shahghasiadil/laravel-env-validator)[ RSS](/packages/shahghasiadil-laravel-env-validator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (4)Versions (9)Used By (0)

Laravel Env Validator
=====================

[](#laravel-env-validator)

The `laravel-env-validator` package provides a way to validate your `.env` configuration values in a Laravel application.

Installation
------------

[](#installation)

1. **Install via Composer**:

    ```
    composer require shahghasiadil/laravel-env-validator
    ```
2. **Publish the Configuration**:

    ```
    php artisan vendor:publish --tag=config --provider="LaravelEnvValidator\LaravelEnvValidatorServiceProvider"
    ```

Usage
-----

[](#usage)

1. **Generating Validation Rules from .env**:

    To generate validation rules based on your `.env` values:

    ```
    php artisan env:generate-rules
    ```

    This will read your `.env` file, generate validation rules, and store them in `config/env-validator.php`.
2. **Checking Env Validity**:

    To validate your current environment based on the generated rules:

    ```
    php artisan env:vaildate
    ```
3. **Middleware**:

    Ensure your environment is valid on every request by adding the middleware:

    ```
    protected $middlewareAliases = [
        'ensureValidEnv' => \LaravelEnvValidator\Middlewares\EnsureValidEnv::class,
    ];
    ```

    Add this to your `app/Http/Kernel.php`.

    ```
     Route::middleware('ensureValidEnv')->group(function () {
         // ... code
     });

    ```

    Add middleware to your `routes/web.php`
4. **Customize Validation Rules**:

    To add or modify validation rules, edit the `config/env-validator.php`.

Configuration
-------------

[](#configuration)

All configuration for this package is stored in the `env-validator.php` config file. It contains an array of validation rules corresponding to each key in your `.env` file.

Changelog
---------

[](#changelog)

For a detailed changelog, see the [CHANGELOG](CHANGELOG.md).

Configs
-------

[](#configs)

If env changes aren't working please run the following command:

```
php artisan config:clear
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~145 days

Total

3

Last Release

689d ago

PHP version history (2 changes)v1.0.0PHP ^7.3|^8.0

v1.0.2PHP ^7.3|^8.0|^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a0a3bb25b5438613463e20699f30cc02e24a0e57e7d171208e3d19bd6bf7b4a?d=identicon)[shahghasiadil](/maintainers/shahghasiadil)

---

Top Contributors

[![shahghasiadil](https://avatars.githubusercontent.com/u/64509320?v=4)](https://github.com/shahghasiadil "shahghasiadil (16 commits)")

---

Tags

envenvironment-variableslaravelphpshahghasiadilvalidatorlaravelvalidatorenvlaravel-env-validator

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/shahghasiadil-laravel-env-validator/health.svg)

```
[![Health](https://phpackages.com/badges/shahghasiadil-laravel-env-validator/health.svg)](https://phpackages.com/packages/shahghasiadil-laravel-env-validator)
```

###  Alternatives

[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[sunspikes/clamav-validator

Custom Laravel 5 anti-virus validator for file uploads.

3651.8M3](/packages/sunspikes-clamav-validator)[laravel-validation-rules/credit-card

Validate credit card number, expiration date, cvc

2412.2M5](/packages/laravel-validation-rules-credit-card)[illuminatech/validation-composite

Allows uniting several validation rules into a single one for easy re-usage

184485.5k](/packages/illuminatech-validation-composite)[laravel-validation-rules/phone

Validate that a phone number is in the correct format

69355.5k](/packages/laravel-validation-rules-phone)[stuyam/laravel-phone-validator

A phone validator for Laravel using the free Twilio phone lookup service.

2861.3k](/packages/stuyam-laravel-phone-validator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
