seferov / composer-env-script
Composer script for handling gitignored env files
Installs: 24 696
Dependents: 0
Suggesters: 0
Security: 0
Stars: 10
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^7.4 || ^8.0
- seferov/env-php: ^1.0
Requires (Dev)
- composer/composer: ^2.4
README
The package allows creating or updating ignored env file (ex: .env.local
) based on
a default env file (ex: .env
) interactively.
Installation
composer require seferov/composer-env-script
Modify your composer.json
file:
{ "scripts": { "post-install-cmd": [ "Seferov\\ComposerEnvScript\\ScriptHandler::buildEnv" ], "post-update-cmd": [ "Seferov\\ComposerEnvScript\\ScriptHandler::buildEnv" ] } }
Configuration
By default, the package generates/updates .env.local
file based on .env
. This can be
changed trough composer.json extra. The configuration also allows managing multiple .env files:
{ "extra": { "seferov-env": [ { "from-file": ".env", "to-file": ".env.local" }, { "from-file": "somepath/.env.test", "to-file": "somepath/.env.test.local" } ] } }
Credits
The package is highly inspired by https://github.com/Incenteev/ParameterHandler which is for managing ignored parameters.