Warning: You are browsing the documentation for Symfony 4.0, which is no longer maintained.
Read the updated version of this page for Symfony 5.3 (the current stable version).
Configuration usually involves different application parts (such as infrastructure and security credentials) and different environments (development, production). That’s why Symfony recommends that you split the application configuration into three parts.
The name of your configuration parameters should be as short as possible and should include a common prefix for the entire application.
app. as the prefix of your parameters is a common practice to avoid
collisions with Symfony and third-party bundles/libraries parameters. Then, use
just one or two words to describe the purpose of the parameter:
1 2 3 4 5 6 7 8 9 10
# config/services.yaml parameters: # don't do this: 'dir' is too generic and it doesn't convey any meaning app.dir: '...' # do this: short but easy to understand names app.contents_dir: '...' # it's OK to use dots, underscores, dashes or nothing, but always # be consistent and use the same format for all the parameters app.dir.contents: '...' app.contents-dir: '...'
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.