amsdard / composer-load-env
Simple handler to inject custom environment variables into composer scripts by load defined ENV files
v1.0
2017-11-13 10:20 UTC
Requires
- symfony/dotenv: ^3.3
This package is not auto-updated.
Last update: 2024-11-14 19:06:27 UTC
README
Simple handler to inject custom environment variables into composer scripts by load defined ENV files
Usage
- install library
composer require amsdard/composer-load-env
- add ENV files into
composer.json
asextra.env-files
param
{
...
"extra": {
...
"env-files": [
"FILE-PATH-1",
"FILE-PATH-2"
],
}
}
- add
load-env-files
script info Yourcompoer.json
{
...
"scripts": {
"load-env-files": [
"Amsdard\\Component\\EnvHandler::loadEnvFiles"
],
},
...
}
- use
@load-env-files
in other scripts
{
...
"scripts": {
"post-install-cmd": [
"@load-env-files",
"@symfony-scripts"
],
...
},
...
}
Workflow
@load-env-files
script will load files defined atextra.env-files
param- environment variables from files will be available in the current script scope