Caution: You are browsing the legacy 1.x part of this website.
This version of symfony is not maintained anymore. If some of your projects still use this version, consider upgrading.

Table of Contents

This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported License license.

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

The app.yml Configuration File

The Reference Book
Support symfony!
Buy this book
or donate.
Buy The Reference Book from amazon.com

The symfony framework provides a built-in configuration file for application specific settings, the app.yml configuration file.

This YAML file can contain any setting you want that makes sense for your specific application. In the code, these settings are available through the global sfConfig class, and keys are prefixed with the app_ string:

sfConfig::get('app_active_days');

All settings are prefixed by app_ because the sfConfig class also provides access to symfony settings and project directories.

As discussed in the introduction, the app.yml file is environment-aware, and benefits from the configuration cascade mechanism.

The app.yml configuration file is a great place to define settings that change based on the environment (an API key for instance), or settings that can evolve over time (an email address for instance). It is also the best place to define settings that need to be changed by someone who does not necessarily understand symfony or PHP (a system administrator for instance).

tip

Refrain from using app.yml to bundle application logic.

note

The app.yml configuration file is cached as a PHP file; the process is automatically managed by the sfDefineEnvironmentConfigHandler class.