PHPackages                             aoemedia/envsettingstool - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. aoemedia/envsettingstool

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

aoemedia/envsettingstool
========================

Environment Settings Tool

1.4.4(9y ago)595.5k24[5 PRs](https://github.com/AOEpeople/EnvSettingsTool/pulls)GPL v3PHPPHP &gt;=5.3.2

Since Jan 15Pushed 2y ago40 watchersCompare

[ Source](https://github.com/AOEpeople/EnvSettingsTool)[ Packagist](https://packagist.org/packages/aoemedia/envsettingstool)[ Docs](https://github.com/AOEpeople/EnvSettingsTool)[ RSS](/packages/aoemedia-envsettingstool/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (1)Versions (15)Used By (0)

What is EnvSettingsTool?
========================

[](#what-is-envsettingstool)

[![Build Status](https://camo.githubusercontent.com/884f6b79685b9c8927d914a7c212cf6f7b828845e7ea3e7b8a641fae1f87389a/68747470733a2f2f7472617669732d63692e6f72672f414f4570656f706c652f456e7653657474696e6773546f6f6c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/AOEpeople/EnvSettingsTool)

Author: [Fabrizio Branca](https://twitter.com/fbrnc)

EnvSettingsTool offers a concept to adjust settings for applications. Typically it is used during deployment. The settings for every Environment can be maintained in an CSV file.

CSV File
--------

[](#csv-file)

This is an example CSV file:

HandlerParam1Param2Param3DEFAULTdevboxintegrationstagingproduction\# Database parametersEst\_Handler\_XmlFileapp/etc/local.xml/config/global/resources/default\_setup/connection/hostlocalhost\# Dev settingsEst\_Handler\_Magento\_CoreConfigDatadefault0dev/debug/profiler01[![CSV file](doc/csv.jpg "CSV file")](doc/csv.jpg)

Each row is one setting. A setting is changed by a "handler", and each handler support up to 3 parameters. The next columns represent the values for the environments, and you may use the "DEFAULT" key for a default setting. Empty column values will fall back to the "DEFAULT" column (instead of setting an empty value). If you want to set an empty value instead configure that cell with `--empty--` and it will set an empty value instead of falling back.

Usage
-----

[](#usage)

The tool comes with 3 commands:

### Dry-Run

[](#dry-run)

Just print out the Handler and Values that would be executed:

```
php dryRun.php devbox ../settings.csv

```

### Apply

[](#apply)

Execute the handlers and show status summary:

```
php apply.php devbox ../settings.csv

```

### Get single value

[](#get-single-value)

Returns the value for a certain handler. For example - this can be used to get database values for other scripts:

```
php value.php devbox ../Settings.csv HandlerName param1 param2 param3

```

Example

```
DB_HOST=`EnvSettingsTool/value.php ${ENVIRONMENT} settings.csv Est_Handler_XmlFile app/etc/local.xml /config/global/resources/default_setup/connection/host`

```

Example setup script snippet
----------------------------

[](#example-setup-script-snippet)

```
echo "Appling settings"
cd htdocs
php ../Setup/EnvSettingsTool/apply.php ${ENVIRONMENT} ../Setup/Settings.csv || exit 1

```

Handlers
--------

[](#handlers)

- **Est\_Handler\_XmlFile**: Can change values in XML

    - Param1: Relative Path to XML File (relative to current directory)
    - Param2: XPath
    - Param3: not used
- **Est\_Handler\_Magento\_CoreConfigData**: Changes values of core\_config\_data table in a Magento instance. It reads its database parameters from app/etc/local.xml - therefore it needs to be placed after any adjustments of DB credentials.

    - Param1: scope ('default', 'stores', 'websites', or '%')
    - Param2: scopeid (store id, store code, website id, website code, 0 for default scope or '%')
    - Param3: path
    - Special features:

        - If the value field of a row for the current environment is `--delete--` the matched row will be deleted
        - param1, param2, or param3 can use the wildcard `%` instead a concrete values. This will make EnvSettingsTool apply the value to multiple existing rows.
        - If scope is `stores` the scope id can be a store code instead of a store id.
        - If scope is `website` the scope id can be a website code instead of a website id.
- **Est\_Handler\_MarkerReplace**: Simply replaces a given marker in a file

    - Param1: Relative Path to File (relative to current directory)
    - Param2: Marker that will be replaced
    - Param3: not used
- **Est\_Handler\_AddFileContent**: Adds the content from one file to the content of another file

    - Param1: targetFile path
    - Param2: 'before', 'after', 'prepend', or 'append'
    - Param3: not used
    - Value: contentFile path
- **Est\_Handler\_PrependFileContent**: Prepends the content from one file to the content of another file (This is just a shortcut for the AddFileContent handler)

    - Param1: targetFile path
    - Param2: not used
    - Param3: not used
    - Value: contentFile path
- **Est\_Handler\_SetVar**: Allows you to set variables that can be used in all following handlers using `###VAR:###`

    - Param1: variable name
    - Param2: not used
    - Param3: not used
- **Est\_Handler\_CopyFile**: Allows you to copy a file from sourceFile path to targetFile path.

    - Param1: targetFile path
    - Param2: not used
    - Param3: not used
    - Value: sourceFile path
- **Est\_Handler\_Magento\_EavEntityStore**: Sets a predefined increment prefix. The last increment id will be set to 00000000.

    - Param1: entity type code or entity type id
    - Param2: store code or store id
    - Param3: increment prefix
- **Est\_Handler\_Magento\_AdminUserActivate**: Allows to enabled/disabled admin user accounts based on username, email or roles (wildcards supported)

    - Param1: Username
    - Param2: Email
    - Param3: Rolename
    - Value: 1=enabled, 0=disabled
- **Est\_Handler\_Magento\_StoreActivate**: Enables/disables an existing store

    - Param1: store id or code
    - Param2: not used
    - Param3: not used
    - Value: 0 for disable, 1 for enable
- **Est\_Handler\_Magento\_Api2AclRule**: Configures Mage\_Api2 rules

    - Param1: role\_id or role name
    - Param2: resource\_id
    - Param3: privilege
    - Value: 0/--delete-- for delete, 1/--insert-- for insert
- **Est\_Handler\_Magento\_Api2AclAttribute**: Configures Mage\_Api2 attributes

    - Param1: user\_type (admin, customer or guest - lowercase!)
    - Param2: resource\_id
    - Param3: operation
    - Value: allowed\_attributes
- **Est\_Handler\_Akeneo\_BatchJobInstanceData**: Changes values of akeneo\_batch\_job\_instance table in a Akeneo instance. It reads its database parameters from app/config/parameters.yml - therefore it needs to be placed after any adjustments of DB credentials.

    - Param1: jobcode ('csv\_products\_export', 'magento\_attributes\_export', etc.)
    - Param2: key (key of the serialized configuration value to replace)
    - Param3: not used
    - Special features:

        - If the value field of a row for the current environment is `--delete--` the matched export job will be deleted

Special Features
----------------

[](#special-features)

### Comments and empty lines

[](#comments-and-empty-lines)

Empty lines or lines starting with '#' or '/' will be ignored. Use this to insert some comments into the csv file.

### Skipping rows

[](#skipping-rows)

If the value field of a row for the current environment is `--skip--` this handler will not be executed

### Environment variables

[](#environment-variables)

The Values also support the special syntax `###ENV:VARIABLE###` to read stuff from the (bash) environment Variables.

### Reading file content

[](#reading-file-content)

The special syntax `###FILE:filename###` allows to read the content of a file and insert the trimmed value.

Example:

```
Est_Handler_XmlFile('app/etc/local.xml', '/config/global/cache/id_prefix', '') = x###FILE:../build.txt###_

```

Will read the content of ../build.txt and insert it in the id\_prefix node: x72\_

### Loops

[](#loops)

param1, param2 and param3 can specify loops using this syntax: `{{1|2|3}}`. In this case the same handler will be executed multiple times using every values. It's also possible to have loops in two or all three parameters. In this case all combinations will be executed.

Example:

```
Est_Handler_Magento_CoreConfigData('stores', '{{1|2|3}}', 'web/unsecure/base_url') = 'http://www.foo.com'

```

Is equal to:

```
Est_Handler_Magento_CoreConfigData('stores', '1', 'web/unsecure/base_url') = 'http://www.foo.com'
Est_Handler_Magento_CoreConfigData('stores', '2', 'web/unsecure/base_url') = 'http://www.foo.com'
Est_Handler_Magento_CoreConfigData('stores', '3', 'web/unsecure/base_url') = 'http://www.foo.com'

```

This loop resolution now also works within paramters:

```
Est_Handler_Magento_CoreConfigData('stores', '1', 'a/b/{{c|d|e}}') = 'http://www.foo.com'

```

Is equal to:

```
Est_Handler_Magento_CoreConfigData('stores', '1', 'a/b/c') = 'http://www.foo.com'
Est_Handler_Magento_CoreConfigData('stores', '1', 'a/b/d') = 'http://www.foo.com'
Est_Handler_Magento_CoreConfigData('stores', '1', 'a/b/e') = 'http://www.foo.com'

```

Multiple loops are also support within the same parameter:

```
Est_Handler_Magento_CoreConfigData('stores', '1', '{{a|b}}_{{c|d}') = 'http://www.foo.com'

```

Is equal to:

```
Est_Handler_Magento_CoreConfigData('stores', '1', 'a_c') = 'http://www.foo.com'
Est_Handler_Magento_CoreConfigData('stores', '1', 'a_d') = 'http://www.foo.com'
Est_Handler_Magento_CoreConfigData('stores', '1', 'b_c') = 'http://www.foo.com'
Est_Handler_Magento_CoreConfigData('stores', '1', 'b_d') = 'http://www.foo.com'

```

Empty values in loops are also allowed:

```
Est_Handler_Magento_CoreConfigData('stores', '1', 'web/secure/base{{_skin|_media|_js|}}_url') = 'http://www.foo.com'

```

Is equal to:

```
Est_Handler_Magento_CoreConfigData('stores', '1', 'web/secure/base_skin_url') = 'http://www.foo.com'
Est_Handler_Magento_CoreConfigData('stores', '1', 'web/secure/base_media_url') = 'http://www.foo.com'
Est_Handler_Magento_CoreConfigData('stores', '1', 'web/secure/base_js_url') = 'http://www.foo.com'
Est_Handler_Magento_CoreConfigData('stores', '1', 'web/secure/base_url') = 'http://www.foo.com'

```

### Fallback

[](#fallback)

An empty cell falls back the configured DEFAULT column. If you actually need that value to be empty use `--empty--` instead.

### References to other environments

[](#references-to-other-environments)

You can reference to values from another environment by adding this to the value: `###REF:targetenvironment###`

### Special markers

[](#special-markers)

- `###ENVIRONMENT###` will be replaced with current environment name (e.g. "production"). This replacement is done after resolving any references to other environments. So the environment being inserted here is always the actual environment requested and not the one of a referenced value.
- `###CWD###` will be replaced with the path to the current working directory.
- `###PARAM1###` will be replaced with the given param1. Also works if the parameter is given in the loop syntax `{{..|..}}`. Then the individual value will be set.
- `###PARAM2###` will be replaced with the given param2. Also works if the parameter is given in the loop syntax `{{..|..}}`. Then the individual value will be set.
- `###PARAM3###` will be replaced with the given param3. Also works if the parameter is given in the loop syntax `{{..|..}}`. Then the individual value will be set.

Ignore errors
-------------

[](#ignore-errors)

If a handler name if prefixed with `@` then this error will be ignored and the apply command continues walking through the list.

Groups
------

[](#groups)

The csv settings file can cotain another column labelled with "GROUPS" (all uppercase!). Every value in this column can be a comma separated list of groups (or 'tags' if you like) similar to how PHPUnit handles groups.

When calling the apply.php script you can pass `--groups ` or `--exclude-groups `. If `--groups` is set only the lines will be processed that have at least one of the groups passed as a parameter. If `--exclude-groups` is set the lines will be skipped if they have at least one group in common with what is specified.

Please note that the argument does not support '=' but only spaces. (use `--groups db`, not `--groups=db`)

Example:

```
# Will only execute rows tagged with 'db'
./apply.php devbox ../Configuration/settings.csv --groups db

# Will skip executing rows tagged with 'db'
./apply.php devbox ../Configuration/settings.csv --exclude-groups db

```

Tips and tricks
---------------

[](#tips-and-tricks)

### Admin user management

[](#admin-user-management)

Disable all admin users:

```
Est_Handler_Magento_AdminUserActivate('%', '%', '%') = 0

```

Enable user 'john.doe':

```
Est_Handler_Magento_AdminUserActivate('john.doe', '%', '%') = 1

```

Enable user with email address '':

```
Est_Handler_Magento_AdminUserActivate('%', 'info@example.com', '%') = 1

```

Enable all user with email addresses '[...@example.com](mailto:...@example.com)':

```
Est_Handler_Magento_AdminUserActivate('%', '%@example.com', '%') = 1

```

Enable all users with role 'Customer Service':

```
Est_Handler_Magento_AdminUserActivate('%', '%', 'Customer Service') = 1

```

Remember that EnvSettingsTool processes the csv file from top to bottom. You can use this to add exact control over what accounts should be enabled or not.

### Delete values

[](#delete-values)

If you're setting Magento core\_config\_data values and you want to be sure that there's no other value that might interfere with your values (e.g. in a different scope) you can delete all values first:

HandlerParam1Param2Param3DEFAULTEst\_Handler\_Magento\_CoreConfigData%%dev/debug/profiler--delete--Est\_Handler\_Magento\_CoreConfigDatadefault0dev/debug/profiler0### Use via Composer

[](#use-via-composer)

Add this to your composer.json to resolve the dependency through composer:

```
"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/AOEpeople/EnvSettingsTool"
    }
],
"require": {
    "aoepeople/envsettingstool": "~1.0"
}

```

Changelog
---------

[](#changelog)

### Version 1.0.0

[](#version-100)

- Added composer support

### Version 1.1.0

[](#version-110)

- Added support for arguments
- Added --groups and --exclude-groups feature

### Version 1.2.0

[](#version-120)

- Added support for Magento admin users

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community26

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~111 days

Recently: every ~132 days

Total

11

Last Release

3390d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a7c128588934775b07942f0a35a325d72cb06acb975f4527e20b4a20ded97d18?d=identicon)[fbrnc](/maintainers/fbrnc)

---

Top Contributors

[![LeeSaferite](https://avatars.githubusercontent.com/u/47386?v=4)](https://github.com/LeeSaferite "LeeSaferite (16 commits)")[![danielpoe](https://avatars.githubusercontent.com/u/567606?v=4)](https://github.com/danielpoe "danielpoe (9 commits)")[![fbrnc](https://avatars.githubusercontent.com/u/468820?v=4)](https://github.com/fbrnc "fbrnc (7 commits)")[![Zyava](https://avatars.githubusercontent.com/u/957560?v=4)](https://github.com/Zyava "Zyava (5 commits)")[![bastianccm](https://avatars.githubusercontent.com/u/1145424?v=4)](https://github.com/bastianccm "bastianccm (2 commits)")[![chadrien](https://avatars.githubusercontent.com/u/1788218?v=4)](https://github.com/chadrien "chadrien (1 commits)")[![ksommer](https://avatars.githubusercontent.com/u/1073147?v=4)](https://github.com/ksommer "ksommer (1 commits)")[![DanielSousa](https://avatars.githubusercontent.com/u/906610?v=4)](https://github.com/DanielSousa "DanielSousa (1 commits)")[![michaelklapper](https://avatars.githubusercontent.com/u/272700?v=4)](https://github.com/michaelklapper "michaelklapper (1 commits)")[![tmotyl](https://avatars.githubusercontent.com/u/515397?v=4)](https://github.com/tmotyl "tmotyl (1 commits)")[![bmartus](https://avatars.githubusercontent.com/u/4819899?v=4)](https://github.com/bmartus "bmartus (1 commits)")

### Embed Badge

![Health badge](/badges/aoemedia-envsettingstool/health.svg)

```
[![Health](https://phpackages.com/badges/aoemedia-envsettingstool/health.svg)](https://phpackages.com/packages/aoemedia-envsettingstool)
```

###  Alternatives

[andersondanilo/cnab_php

Projeto para criar arquivos de remessas e processar arquivos de retorno no formato CNAB

334260.6k2](/packages/andersondanilo-cnab-php)[opensrs/osrs-toolkit-php

OpenSRS PHP Toolkit

7668.6k](/packages/opensrs-osrs-toolkit-php)[clausnz/php-helpers

A Collection of useful php helper functions.

388.7k](/packages/clausnz-php-helpers)[bnomei/autoloader-for-kirby

Helper to automatically load various Kirby extensions in a plugin

185.7k2](/packages/bnomei-autoloader-for-kirby)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
