2017 © Pedro Peláez
 

library php-set-env

Tool for setting options in .ENV files over the CLI

image

softbricks/php-set-env

Tool for setting options in .ENV files over the CLI

  • Tuesday, October 17, 2017
  • by SMenigat
  • Repository
  • 4 Watchers
  • 0 Stars
  • 1,139 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 13 % Grown

The README.md

php-set-env

This tool helps setting .env file configs via the command line., (*1)

Install

We recommend installing the package via composer., (*2)

composer require softbricks/php-set-env

After that, it is most practical to create a composer script (within composer.json) for easier usage:, (*3)

{
    "scripts": {
        "set-env": [
            "SoftBricks\\CLI\\SetEnv::execute"
        ]
    }
}

Usage

Let's say we have a .env file that looks like this ..., (*4)

FOO=BAR

[CATEGORY1]
NESTED_PARAM=Hi, I am nested

... and we want reset the value of FOO. This can be done with:, (*5)

composer set-env -- --key=FOO --value="not bar anymore"

This call results in the following .env file:, (*6)

FOO=not bar anymore

[CATEGORY1]
NESTED_PARAM=Hi, I am nested

It is also possible to add new key / value pairs, with the same call structure. For example:, (*7)

composer set-env -- --key=NEW --value="wow I'm so new"

To set the NESTED_PARAM within CATEGORY1 we have to structure our call like this:, (*8)

composer set-env -- --category=CATEGORY1 --key=NESTED_PARAM --value="Changed nested param"

The Versions

17/10 2017

dev-master

9999999-dev

Tool for setting options in .ENV files over the CLI

  Sources   Download

The Requires

 

by Samuel Menigat

17/10 2017

v1.0.1

1.0.1.0

Tool for setting options in .ENV files over the CLI

  Sources   Download

The Requires

 

by Samuel Menigat

17/10 2017

v1.0.0

1.0.0.0

Tool for setting options in .ENV files over the CLI

  Sources   Download

The Requires

 

by Samuel Menigat