laramicstudio/env-guard

It lets you define a schema for your .env file — think of it like a contract. When your app boots, it checks your actual .env against that contract and fails loudly and early if something is wrong.It lets you define a schema for your .env file — think of it like a contract. When your app boots, it c

Maintainers

Package info

github.com/hassan402-paymentrequired/env-guard

Homepage

pkg:composer/laramicstudio/env-guard

Fund package maintenance!

laramic studio

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.60.0 2026-03-10 09:33 UTC

This package is auto-updated.

Last update: 2026-04-14 22:51:31 UTC


README

App Screenshot

ENV-GUARD

lets you define a schema for your .env file — think of it like a contract. When your app boots, it checks your actual .env against that contract and fails loudly and early if something is wrong.

composer require laramicstudio/env-guard

You can publish the config file with:

php artisan vendor:publish --tag="env-guard-config"

If you are installing on a already existing project you can run the command

php artisan env:check

This is the contents of the published config file:

return [

    'log_rejections' => false,

    'log_channel' => 'stack',

    'rules' => [
        'APP_KEY' => 'required|string',
        'APP_ENV' => 'required|in:local,staging,production',
        'DB_PASSWORD' => 'required|string|min:8',
        'STRIPE_SECRET' => 'required|starts_with:sk_',
        'CACHE_TTL' => 'required|integer|min:1',
        'MAIL_PORT' => 'nullable|integer',
    ],
];

Usage

$envGuard = new LaramicStudio\EnvGuard();
$envGuard->validate();

Testing

composer test

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.