Skip to content

Add a new article about Symfony configuration #7386

Closed
@javiereguiluz

Description

@javiereguiluz

Config is one of the worst documented Symfony features. There's not a single resource where we answer to this question clearly: How should I configure my Symfony application?

The confusion is multiple (most of the times because of the docs, but sometimes because the required code is too convoluted):

  • incenteev-parameters and parameters.yml + parameters.yml.dist should be better explained. This behavior is very confusing for newcomers (at least from my experience).
  • We have 3 different ways to configure environment variables: 1) SYMFONY__, 2) %env()$ and 3) .env Are they compatible or mutually exclusive? Should I combine them? Which one should I use?
  • There are too many config files: parameters.yml, parameters.yml.dist, config.yml, config_dev.yml, config_prod.yml, config_test.yml, .env, .ev.dist, security.yml, services.yml
  • Loading config files from bundles is still confusing for some people. They expect those files to be loaded "by convention" when they are stored in the right location (e.g. Resources/config/services.xml) but they are not. Then it's confusing what to do: 1) should I add them to the main config.yml as "resource: @MyBundle/Resources/config/services.xml"; or 2) should I do what's explained here: http://symfony.com/doc/current/bundles/extension.html (even Fabien said that bundle extensions should only be created by third-party bundles, not by in-app bundles)
  • Defining validation rules for config parameters is again confusing and requires a lot of work (such as defining the Configuration tree). Should I do this for my in-app bundles? Is there an easier way to validate them? Etc.
  • We don't explain how to handle sensitive config options (e.g. the database passwords). We tell them what not to do ("don't put the .env or production parameters.yml in the repository") but not what to do (how can I manage the secrets of my application? where/how do I store them? and how do I upload them to the production server?)

So I'd like to read your ideas and comments and then prepare a plan to solve this issue. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions