File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,31 @@ whereas they cannot access the container parameters:
153153 The only notable disadvantage of using constants for this kind of configuration
154154values is that you cannot redefine them easily in your tests.
155155
156+ Parameter Naming
157+ ----------------
158+
159+ .. best-practice ::
160+
161+ The name of your configuration parameters should be as short as possible and
162+ should include a common prefix for the entire application.
163+
164+ Using ``app. `` as the prefix of your parameters is a common practice to avoid
165+ collisions with Symfony and third-party bundles/libraries parameters. Then, use
166+ just one or two words to describe the purpose of the parameter:
167+
168+ .. code-block :: yaml
169+
170+ # app/config/config.yml
171+ parameters :
172+ # don't do this: 'dir' is too generic and it doesn't convey any meaning
173+ app.dir : ' ...'
174+ # do this: short but easy to understand names
175+ app.contents_dir : ' ...'
176+ # it's OK to use dots, underscores, dashes or nothing, but always
177+ # be consistent and use the same format for all the parameters
178+ app.dir.contents : ' ...'
179+ app.contents-dir : ' ...'
180+
156181 Semantic Configuration: Don't Do It
157182-----------------------------------
158183
You can’t perform that action at this time.
0 commit comments