Format .env files according to your .env.example structure to keep track of used and unused variables
romanzipp/laravel-env-normalizer is a Laravel package for format .env files according to your .env.example structure to keep track of used and unused variables.
It currently has 1 GitHub stars and 7.110 downloads on Packagist (latest version 1.3.0).
Install it with composer require romanzipp/laravel-env-normalizer.
Discover more Laravel packages by romanzipp
or browse all Laravel packages to compare alternatives.
Last updated
Format .env files according to your .env.example structure to keep track of used and unused variables.
I like to keep a clear overview of all available environment variables by adding some default values to my version controled .env.example file.
This packages helps with structuring your example files.
composer require romanzipp/laravel-env-normalizer --dev
php artisan env:normalize
php artisan env:normalize --help
Reference and target options are optional. If not specified the command will only look for a .env.example (as reference) and .env file (as target).
php artisan env:normalize --reference=.env.example --target=.env --target=.env.local
This option will discover any other .env.* files located in the base path and add them to the target list.
php artisan env:normalize --auto
This will create a {name}.bak backup file for each modified target file.
php artisan env:normalize --backup
Log the expected output to the console instead of writing it to the file.
php artisan env:normalize --dry
| .env.example | previous .env | new .env |
| --- | --- | --- |
|
BASE_URL=localhost|
# Database
DB_HOST=127.0.0.1
DB_PORT=${DEFAULT_PORT}
DB_USER=
DB_PASSWORD=
MAIL_CONNECTION=
DB_HOST=10.0.0.10|
BASE_URL=me.com
DB_USER=prod
DB_PASSWORD=123456
MAIL_CONNECTION=foo
MAIL_USER=tim
#DEV_PW=123
BASE_URL=me.com|
# Database
DB_HOST=10.0.0.10
DB_USER=prod
DB_PASSWORD=123456
MAIL_CONNECTION=foo
# Additional
MAIL_USER=tim
# Unset
#DEV_PW=123
.env files will be taken from the reference .env.example file.env file will be appended to the bottom so you can later add them to your version controled example file#FOO=bar which do not start with hash + space # will be appended to the endMAIL_FROM below MAIL_CONNECTION instead of appendin it to the end)./vendor/bin/phpunit