PHPackages                             serrvius/composer-parameter-handler - 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. serrvius/composer-parameter-handler

AbandonedLibrary

serrvius/composer-parameter-handler
===================================

Composer script handling your ignored parameter file, parse multiple parameters, custom description for scripts, recursive parse

2.1.7(7y ago)0123MITPHPPHP &gt;=5.3.3

Since Apr 6Pushed 7y ago1 watchersCompare

[ Source](https://github.com/serrvius/ParameterHandler)[ Packagist](https://packagist.org/packages/serrvius/composer-parameter-handler)[ Docs](https://github.com/serrvius/ParameterHandler)[ RSS](/packages/serrvius-composer-parameter-handler/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (5)Versions (9)Used By (0)

Managing your ignored parameters with Composer
==============================================

[](#managing-your-ignored-parameters-with-composer)

This tool allows you to manage your ignored parameters when running a composer install or update. It works when storing the parameters in a Yaml file under a single top-level key (named `parameters` by default). Other keys are copied without change.

Usage
-----

[](#usage)

Add the following in your root composer.json file:

```
{
    "require": {
        "serrvius/composer-parameter-handler": "~2.0"
    },
    "scripts": {
        "post-install-cmd": [
            "Serrvius\\ParameterHandler\\ScriptHandler::buildParameters"
        ],
        "post-update-cmd": [
            "Serrvius\\ParameterHandler\\ScriptHandler::buildParameters"
        ]
    },
    "extra": {
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        }
    }
}
```

The `app/config/parameters.yml` will then be created or updated by the composer script, to match the structure of the dist file `app/config/parameters.yml.dist`by asking you the missing parameters.

By default, the dist file is assumed to be in the same place than the parameters file, suffixed by `.dist`. This can be changed in the configuration:

```
{
    "extra": {
        "incenteev-parameters": {
            "file": "app/config/parameters.yml",
            "dist-file": "some/other/folder/to/other/parameters/file/parameters.yml.dist"
        }
    }
}
```

The script handler will ask you interactively for parameters which are missing in the parameters file, using the value of the dist file as default value. All prompted values are parsed as inline Yaml, to allow you to define `true`, `false`, `null` or numbers easily. If composer is run in a non-interactive mode, the values of the dist file will be used for missing parameters.

**Warning:** This parameters handler will overwrite any comments or spaces into your parameters.yml file so handle with care. If you want to give format and comments to your parameter's file you should do it on your dist version.

### Keeping outdated parameters

[](#keeping-outdated-parameters)

Warning: This script removes outdated params from `parameters.yml` which are not in `parameters.yml.dist`If you need to keep outdated params you can use `keep-outdated` param in the configuration:

```
{
    "extra": {
        "incenteev-parameters": {
            "keep-outdated": true
        }
    }
}
```

### Process multilevel parameters

[](#process-multilevel-parameters)

If in your configuration you have multilevel keys you can use parameter `recursive` and the script will ask you to change the key from secondary level.
If you want to process all levels you can use `recursive` param in the configuration:

```
{
    "extra": {
        "incenteev-parameters": {
            "recursive": true
        }
    }
}
```

### Using a multiple top-level keys

[](#using-a-multiple-top-level-keys)

The script handler looks for a `parameters` key in your dist file. You can change this by using the `parameter-keys` param in the configuration and set at each keys script need to looks:

```
{
    "extra": {
        "incenteev-parameters": {
            "parameter-keys": ["db", "cacheDir", "siteName"]
        }
    }
}
```

### Using environment variables to set the parameters

[](#using-environment-variables-to-set-the-parameters)

For your prod environment, using an interactive prompt may not be possible when deploying. In this case, you can rely on environment variables to provide the parameters. This is achieved by providing a map between environment variables and the parameters they should fill:

```
{
    "extra": {
        "incenteev-parameters": {
            "env-map": {
                "my_first_param": "MY_FIRST_PARAM",
                "my_second_param": "MY_SECOND_PARAM"
            }
        }
    }
}
```

If an environment variable is set, its value will always replace the value set in the existing parameters file.

As environment variables can only be strings, they are also parsed as inline Yaml values to allows specifying `null`, `false`, `true` or numbers easily.

### Renaming parameters

[](#renaming-parameters)

If you are renaming a parameter, the new key will be set according to the usual routine (prompt if possible, use environment variables, use default). To have the parameters handler use the value of an (obsolete) parameter, specify a rename-map:

```
{
    "extra": {
        "incenteev-parameters": {
            "rename-map": {
                "new_param_1": "old_param_1",
                "new_param_2": "old_param_2"
            }
        }
    }
}
```

This will create the new parameters new\_param\_1 and new\_param\_2 while using the values from old\_param\_1 and old\_param\_2, respectively. It will not remove the old parameters unless you've also removed them from the dist version.

If the old parameter is no longer present (maybe because it has been renamed and removed already), no parameters are overwritten. You don't need to remove obsolete parameters from the rename map once they have been renamed.

### Managing multiple ignored files

[](#managing-multiple-ignored-files)

The parameter handler can manage multiple ignored files. To use this feature, the `incenteev-parameters` extra should contain a JSON array with multiple configurations inside it instead of a configuration object:

```
{
    "extra": {
        "incenteev-parameters": [
            {
                "file": "app/config/parameters.yml",
                "env-map": {}
            },
            {
                "file": "app/config/databases.yml",
                "dist-file": "app/config/databases.dist.yml",
                "parameter-keys": ["config"]
            }
        ]
    }
}
```

### Using scripts description

[](#using-scripts-description)

The script can show the custom messages for each scripts for that you can add it with key `description`:

```
{
    "extra": {
        "incenteev-parameters": [
              {
                "description": "Production config",
                "file": "config/app.prod.yml",
                "dist-file": "config/app.yml.dist"
              },
              {
                "description": "Development config",
                "file": "config/app.dev.yml",
                "dist-file": "config/app.yml.dist"
              }
            ]
    }
}
```

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 63.2% of commits — single point of failure

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 ~275 days

Recently: every ~285 days

Total

8

Last Release

2851d ago

Major Versions

v1.0.0 → v2.0.02013-04-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/86bb966d54feb370a0ac4db7a3f5bcd8ba13dde93dcdd775ccb6d5ca9cfdfc62?d=identicon)[serrvius](/maintainers/serrvius)

---

Top Contributors

[![stof](https://avatars.githubusercontent.com/u/439401?v=4)](https://github.com/stof "stof (60 commits)")[![cordoval](https://avatars.githubusercontent.com/u/328359?v=4)](https://github.com/cordoval "cordoval (7 commits)")[![richsage](https://avatars.githubusercontent.com/u/231551?v=4)](https://github.com/richsage "richsage (3 commits)")[![serrvius](https://avatars.githubusercontent.com/u/9820392?v=4)](https://github.com/serrvius "serrvius (3 commits)")[![lsmith77](https://avatars.githubusercontent.com/u/300279?v=4)](https://github.com/lsmith77 "lsmith77 (2 commits)")[![franmomu](https://avatars.githubusercontent.com/u/720690?v=4)](https://github.com/franmomu "franmomu (2 commits)")[![igorzoriy](https://avatars.githubusercontent.com/u/535694?v=4)](https://github.com/igorzoriy "igorzoriy (2 commits)")[![ivan1986](https://avatars.githubusercontent.com/u/156418?v=4)](https://github.com/ivan1986 "ivan1986 (2 commits)")[![alcaeus](https://avatars.githubusercontent.com/u/383198?v=4)](https://github.com/alcaeus "alcaeus (2 commits)")[![rybakit](https://avatars.githubusercontent.com/u/533861?v=4)](https://github.com/rybakit "rybakit (2 commits)")[![soullivaneuh](https://avatars.githubusercontent.com/u/1698357?v=4)](https://github.com/soullivaneuh "soullivaneuh (1 commits)")[![lucascourot](https://avatars.githubusercontent.com/u/938375?v=4)](https://github.com/lucascourot "lucascourot (1 commits)")[![pborreli](https://avatars.githubusercontent.com/u/77759?v=4)](https://github.com/pborreli "pborreli (1 commits)")[![rgazelot](https://avatars.githubusercontent.com/u/1488251?v=4)](https://github.com/rgazelot "rgazelot (1 commits)")[![h4cc](https://avatars.githubusercontent.com/u/2981491?v=4)](https://github.com/h4cc "h4cc (1 commits)")[![elnur](https://avatars.githubusercontent.com/u/821060?v=4)](https://github.com/elnur "elnur (1 commits)")[![fabpot](https://avatars.githubusercontent.com/u/47313?v=4)](https://github.com/fabpot "fabpot (1 commits)")[![sgilberg](https://avatars.githubusercontent.com/u/669465?v=4)](https://github.com/sgilberg "sgilberg (1 commits)")[![j-d](https://avatars.githubusercontent.com/u/1140726?v=4)](https://github.com/j-d "j-d (1 commits)")[![jordillonch](https://avatars.githubusercontent.com/u/601782?v=4)](https://github.com/jordillonch "jordillonch (1 commits)")

---

Tags

parameters managementparameters handlermultilevel paprametersyaml parametersmultiple parameters handler

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/serrvius-composer-parameter-handler/health.svg)

```
[![Health](https://phpackages.com/badges/serrvius-composer-parameter-handler/health.svg)](https://phpackages.com/packages/serrvius-composer-parameter-handler)
```

###  Alternatives

[incenteev/composer-parameter-handler

Composer script handling your ignored parameter file

93174.1M403](/packages/incenteev-composer-parameter-handler)[diarmuidie/envpopulate

Tool to interactively populate a `.env` file based on an `.env.example` file whenever Composer installs or updates.

1892.0k](/packages/diarmuidie-envpopulate)

PHPackages © 2026

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