Skip to content

Instantly share code, notes, and snippets.

@Koc
Forked from jmikola/symfony_configs.md
Created April 16, 2011 18:03
Show Gist options
  • Save Koc/923352 to your computer and use it in GitHub Desktop.
Save Koc/923352 to your computer and use it in GitHub Desktop.

Some rules

Configs exist in three levels:

  1. local
  2. dev | stg | prod
  3. default (no environment)

There are three types of configs:

  1. Application-level
  2. Global-level
  3. Global-level, but feature-specific (e.g. api_router)

Application-level configurations should start off by including their logical parent, applicational-level config, followed by their global-level configuration and/or any global, feature-specific configs (if applicable). Global-level configurations should not include logical parents, since application-level configs do that, but they may include global, feature-specific configs.

app/config/config_local.yml (8) imports:
 * app/config/dev.yml (5), which imports:
   * app/config/config.yml (2), which imports
     * /config/config.yml (1)
   * /config/config_dev.yml (4), which imports:
     * /config/dev/api_router.yml (3)
 * /config/local.yml (7), which imports
   * /config/local/api_router.yml (6)

The numbers beside each file indicate the order in which their contents will be processed. Alternatively:

  1. /config/config.yml
  2. app/config/config.yml
  3. /config/dev/api_router.yml
  4. /config/config_dev.yml
  5. app/config/dev.yml
  6. /config/local/api_router.yml
  7. /config/local.yml
  8. app/config/config_local.yml

The rule of thumb is lowest level first, and for each level, global before application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment