Archives


Master Symfony2 fundamentals

Be trained by SensioLabs experts (2 to 6 day sessions -- French or English).
trainings.sensiolabs.com

Symfony hosting done right

ServerGrove, outstanding support at the right price for your Symfony hosting needs.
servergrove.com

Discover the SensioLabs Support

Access to the SensioLabs Competency Center for an exclusive and tailor-made support on Symfony
sensiolabs.com

Fabien Potencier
Symfony Settings
by Fabien Potencier – February 16, 2009 – 4 comments

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.

Comments RSS

  • gravatar
    #1 John said on the 2009/02/16 at 12:13
    "This document will be part of an upcoming symfony reference book."

    You're a machine!

    You're work is really appreciated :-)
  • gravatar
    #2 Altrano said on the 2009/02/16 at 14:48
    Wow Great work thanks...
  • gravatar
    #3 Gunt said on the 2009/02/16 at 15:20
    wtf, yet another book... this guy is an alien :)
  • gravatar
    #4 Vince said on the 2009/02/16 at 16:36
    hey, you've written symfony with a "S" cap!!! oO