What's the use of parameters.yml file in Symfony

zuzuleinen

I used to write my configs for Symfony project like this in config.yml file:

my_bundle:
    internal_identifier: %test%
    key: %someparam%
    endpoint: %nobil_endpoint%

and used parameters.yml (which was ignored by git) for allowing other developers to have different values.

Bu I think using this:

my_bundle:
    internal_identifier: my-identifier
    key: 12345
    endpoint: www.endpoint.com

still allows developers to have different values because they can use config_dev.yml which is also ignored by Git.

So my question is this: what's the purpose of parameters.yml file if config_dev.yml can be used for the same thing?

Dave Lancea

I think two things are being asked here:

  1. Why is parameters.yml ignored be the default Symfony .gitignore file?
  2. Why use parameters.yml instead of config_dev.yml?

Per the first question, parameters.yml is ignored by default because this file is meant to hold settings which are per-installation. For instance different developers might need different database settings. If parameters.yml wasn't ignored, your "personal" settings would be copied to every developer.

As of Symfony 2.3 you should put the needed parameters, along with default values, in a file called parameters.yml.dist. Then, when you run composer install a composer script will check for this file and create/update your local parameters.yml file, prompting you for each setting which gives you the opportunity to change the settings to be relevant to the given install.

Per the second issue, parameters are considered different than config settings. Parameters are settings which will change install to install, whereas config settings will stay the same for all installs of a particular app (although they may be different from dev to production environments.)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Symfony yml parameters into doctrine yml mapping

From Dev

Symfony yml parameters into doctrine yml mapping

From Dev

Possible to modify / write to a custom parameters.yml file in symfony2?

From Dev

Rails use of yml file

From Dev

symfony how to use custom validators.yml file under MyBundle\Resources\translations

From Dev

What is fields.yml file

From Dev

Passing constructor arguments in routing yml file in Symfony

From Dev

Use array from parameters.yml in routing.yml

From Dev

unsupported keys in Symfony -what's wrong with my YAML file

From Dev

Symfony2 get parameters.yml in entity, special case

From Dev

Symfony2: how to read parameters array in config.yml

From Dev

Factories.yml parameters for Multiple Mailer instances in Symfony 1.4

From Dev

PHPUnit symfony2 faking parameters.yml

From Dev

A parameters.yml per bundle, symfony2

From Dev

PHPUnit symfony2 faking parameters.yml

From Dev

Factories.yml parameters for Multiple Mailer instances in Symfony 1.4

From Dev

Number index in parameters.yml corrupted Symfony2

From Dev

What are the intended use cases for the resolve function's context and rootValue parameters?

From Dev

What's the use of passing function expression variables as parameters?

From Dev

How to use Symfony's default autoloading in an external file

From Dev

Use a PHP file to Symfony

From Dev

Difference between parameters.yml and config.yml in Symfony2

From Dev

How to use Property placeholders in .yml file

From Dev

Symfony2 Use parameters in EntityRepository

From Dev

Symfony trying to use an array of id in set parameters

From Dev

Symfony 3 use parameters in class that is not a service

From Dev

how to use if isset() with symfony and post parameters

From Dev

Optional parameter value in Symfony's main config.yml

From Dev

Symfony2 : parameters of the controller's router

Related Related

  1. 1

    Symfony yml parameters into doctrine yml mapping

  2. 2

    Symfony yml parameters into doctrine yml mapping

  3. 3

    Possible to modify / write to a custom parameters.yml file in symfony2?

  4. 4

    Rails use of yml file

  5. 5

    symfony how to use custom validators.yml file under MyBundle\Resources\translations

  6. 6

    What is fields.yml file

  7. 7

    Passing constructor arguments in routing yml file in Symfony

  8. 8

    Use array from parameters.yml in routing.yml

  9. 9

    unsupported keys in Symfony -what's wrong with my YAML file

  10. 10

    Symfony2 get parameters.yml in entity, special case

  11. 11

    Symfony2: how to read parameters array in config.yml

  12. 12

    Factories.yml parameters for Multiple Mailer instances in Symfony 1.4

  13. 13

    PHPUnit symfony2 faking parameters.yml

  14. 14

    A parameters.yml per bundle, symfony2

  15. 15

    PHPUnit symfony2 faking parameters.yml

  16. 16

    Factories.yml parameters for Multiple Mailer instances in Symfony 1.4

  17. 17

    Number index in parameters.yml corrupted Symfony2

  18. 18

    What are the intended use cases for the resolve function's context and rootValue parameters?

  19. 19

    What's the use of passing function expression variables as parameters?

  20. 20

    How to use Symfony's default autoloading in an external file

  21. 21

    Use a PHP file to Symfony

  22. 22

    Difference between parameters.yml and config.yml in Symfony2

  23. 23

    How to use Property placeholders in .yml file

  24. 24

    Symfony2 Use parameters in EntityRepository

  25. 25

    Symfony trying to use an array of id in set parameters

  26. 26

    Symfony 3 use parameters in class that is not a service

  27. 27

    how to use if isset() with symfony and post parameters

  28. 28

    Optional parameter value in Symfony's main config.yml

  29. 29

    Symfony2 : parameters of the controller's router

HotTag

Archive