SymfonyWorld Online 2021 Winter Edition December 9 – 10, 2021 100% Online +20 talks and workshops

Symfony Settings

The symfony framework configurability is one of its most appealing strength, but it is also a thing that comes back over and over again as a weakness. Why? Because some people think that symfony has way too many settings that need to be changed when creating a new project. That's totally wrong. In this post, I will try to give an objective point of view on this matter as of symfony 1.2.

If you read the Jobeet tutorial, you know that you hardly need to open a configuration file to bootstrap a new project. That's because all settings have sensible defaults. And for settings that need to be changed like the database DSN, or the CSRF secret, the framework provides commands that automate the task:

$ php symfony generate:app --escaping-strategy=on --csrf-secret=UniqueSecret frontend

The above command changes the escaping-strategy and csrf-secret settings automatically for us in the settings.yml configuration file.

$ php symfony configure:database "mysql:host=localhost;dbname=jobeet" root mYsEcret

Again, the above command updates the databases.yml configuration file.

And for most projects, that's all you need to know. Of course, the settings.yml configuration file define others settings. Do you know how many? As of symfony 1.2, 21 different settings:

  • escaping_strategy
  • escaping_method
  • csrf_secret
  • charset
  • enabled_modules
  • cache
  • etag
  • i18n
  • default_culture
  • standard_helpers
  • no_script_name
  • logging_enabled
  • web_debug
  • error_reporting
  • compressed
  • use_database
  • check_lock
  • check_symfony_version
  • web_debug_web_dir
  • strip_comments
  • max_forwards

From these 21 settings, you really need to care about 7 of them:

  • escaping_strategy
  • csrf_secret
  • charset
  • enabled_modules
  • cache
  • i18n
  • default_culture

Why keep settings that barely need to be changed? Some of them were important in the past but are not significant anymore and others are sometimes useful for very specific cases.

Want to learn more about those settings? I have compiled a document with all available settings, their default configuration, and a small description for each of them. This document will be part of an upcoming symfony reference book.

Help the Symfony project!

As with any Open-Source project, contributing code or documentation is the most common way to help, but we also have a wide range of sponsoring opportunities.


"This document will be part of an upcoming symfony reference book."

You're a machine!

You're work is really appreciated :-)
Wow Great work thanks...
wtf, yet another book... this guy is an alien :)
hey, you've written symfony with a "S" cap!!! oO

Comments are closed.

To ensure that comments stay relevant, they are closed for old posts.