PHPackages                             crhg/laravel-env-check - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. crhg/laravel-env-check

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

crhg/laravel-env-check
======================

v1.2.3(8y ago)149MITPHPPHP &gt;=7.0

Since Mar 29Pushed 8y ago1 watchersCompare

[ Source](https://github.com/crhg/laravel-env-check)[ Packagist](https://packagist.org/packages/crhg/laravel-env-check)[ RSS](/packages/crhg-laravel-env-check/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (11)Used By (0)

SUMMARY
=======

[](#summary)

Enhance checking of configuration cache and environment.

DESCRIPTION
===========

[](#description)

Prohibit designation of an explicit environment when configuration is cached
----------------------------------------------------------------------------

[](#prohibit-designation-of-an-explicit-environment-when-configuration-is-cached)

Laravel's environment can be sepcified with the `--env` option of artisan command or `APP_ENV` environment variable, but specified environment is ignored when the configuration is cached.

Since this is potentially dangerous, when configuration is cached, it is prohibited to specify the environment with `--env` option or` APP_ENV` environment variable.

Prohibit designation of environment for `config:cache` command
--------------------------------------------------------------

[](#prohibit-designation-of-environment-for-configcache-command)

When generating the configuration cache with the `config: cache` command, prohibit specification of the environment with the` --env` option or the `APP_ENV` environment variable. Therefore, only the default environment described in the `.env` file can be cached.

Check consistency with `.env` file
----------------------------------

[](#check-consistency-with-env-file)

Saves the checksum of the `.env` file when the config cache is generated. It is checked whether it matches that of the current `.env` file. If they do not match, an error will occur.

Commands to be excluded from check
----------------------------------

[](#commands-to-be-excluded-from-check)

Some artisan commands do not depend on the environment, so exclude them from checking.

If you want to add some commands to exclude, use the `excluded_command` setting in `config/env_check.php`.

INSTALL
=======

[](#install)

```
composer require crhg/laravel-env-check
php artisan vendor:publish --provider='Crhg\EnvCheck\Providers\EnvCheckServiceProvider'
```

Add the following code before `return $app` in `bootstrap/app.php`;

```
        $app->singleton(\Crhg\EnvCheck\EnvChecker::class);

        $app->beforeBootstrapping(
            \Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables::class,
            function ($app) {
                $checker = $app->make(\Crhg\EnvCheck\EnvChecker::class);
                $checker->examineEnvironmentVariables();
            }
        );
```

EXAMPLE
=======

[](#example)

- If `local` environment is cached:

```
% php artisan migrate:status --env=foo
Don't use --env option when configuration is cached
```

- If `.env` is modified after `config:cache`:

```
% php artisan migrate:status
.env hash unmatch
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

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 ~2 days

Total

8

Last Release

2954d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bd1a173eef0d98c0451f8e692aeb623360da4c533d1d15e9d0f6edf5aa4fe12a?d=identicon)[crhg](/maintainers/crhg)

---

Top Contributors

[![crhg](https://avatars.githubusercontent.com/u/8174597?v=4)](https://github.com/crhg "crhg (34 commits)")

---

Tags

laravelphp

### Embed Badge

![Health badge](/badges/crhg-laravel-env-check/health.svg)

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

###  Alternatives

[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)

PHPackages © 2026

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