Shritesh Avlani
Shritesh Avlani

Reputation: 11

Symfony2 Custom configuration file

When we install symfony 2, installer will ask for values of variables from parameter.yml.dist that are not present in parameter.yml.

Is there a way to create your custom yml and yml.dist file in App/config?

e.g. my.yml will be created while installing and parameters defined in my.yml.dist will be prompted for values at the time of installation.

Upvotes: 1

Views: 161

Answers (1)

Crozin
Crozin

Reputation: 44376

Yes, you can create a bunch of custom configuration files. However this is not strictly related to Symfony itself - it's Composer with Incenteev/ParameterHandler "extension".

In your composer.json file you'll find following fragment:

"extra": {
    "incenteev-parameters": {
        "file": "app/config/parameters.yml",
        "env-map": {
            ...
        }
    }
}

Change it to an array of incenteev-parameters:

"extra": {
    "incenteev-parameters": [
        {
            "file": "app/config/parameters.yml",
            "env-map": {
                ...
            }
        },
        {
            "file": "app/config/my-custom-config.yml",
            "env-map": {
                ...
            }
        }
    ]
}

Upvotes: 3

Related Questions