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
Fund package maintenance!
Requires
- php: ^8.3
- illuminate/contracts: ^11.0||^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^10.0.0||^9.0.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
README
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.
