====== Symfony YAML Configuration Reference ====== =====The settings.yml configuration file===== In this article we assume that you are familiar with [[http://www.symfony-project.org/reference/1_4/en/02-YAML|The YAML Format]] and [[http://www.symfony-project.org/reference/1_4/en/03-Configuration-Files-Principles|Configuration File Principles]]. The //settings.yml// configuration file is the main place where you should configure your application. This file can be found in the //apps/APP_NAME/config/// directory. All settings defined in the //.settings// section are available anywhere in the code by using the //sfConfig// object and prefixing the setting with //sf_//. For instance, to get the value of the //charset// setting, use: sfConfig::get('sf_charset'); env_name: .actions: error_404_module: module_name error_404_action: action_name login_module: module_name login_action: action_name secure_module: module_name secure_action: action_name module_disabled_module: module_name module_disabled_action: action_name .settings: use_database: escaping_strategy: escaping_method: charset: charset_name csrf_secret: secret_value enabled_modules: [module1, module2, ...] standard_helpers: [helper1, helper2, ...] cache: etag: i18n: default_culture: culture_name no_script_name: logging_enabled: web_debug: file_link_format: format_str error_reporting: php_logged_events compressed: check_lock: default_timezone: timezone admin_web_dir: /path/to/assets web_debug_web_dir: /path/to/assets custom_setting: "custom_value" =====Settings configuration options===== ====env_name==== The //settings.yml// file is environment-aware, therefore you can add configurations for different environments by specifying environment name (eg.: //prod//, test) or '//all//' for all environments. ====.actions sub-section==== ====env_name > .actions==== Defines the action to execute when common pages must be rendered. Each definition has two components: one for the module (suffixed by _module), and one for the action (suffixed by _action). ====env_name > .actions > error_404_module==== Specifies module to be called when a 404 error is raised or when the requested URL doesn't match any route. Default: //default// ====env_name > .actions > error_404_action==== Specifies action to be called when a 404 error is raised or when the requested URL doesn't match any route. Default: //error404// ====env_name > .actions > login_module==== Specifies module to be called when a non-authenticated user tries to access a secure page. Default: //default// ====env_name > .actions > login_action==== Specifies action to be called when a non-authenticated user tries to access a secure page. Default: //login// ====env_name > .actions > secure_module==== Specifies module to be called when a user doesn't have the credentials required for an action. Default: //default// ====env_name > .actions > secure_action==== Specifies action to be called when a user doesn't have the credentials required for an action. Default: //secure// ====env_name > .actions > module_disabled_module==== Specifies module to be called when a user requests a module disabled in the module.yml. Default: //default// ====env_name > .actions > module_disabled_action==== Specifies action to be called when a user requests a module disabled in the module.yml. Default: //disabled// ====.settings sub-section==== ====env_name > .settings==== Defines an array of symfony framework configuration settings. ====env_name > .settings > use_database==== Specifies whetheror not to enable database manager for an application. Set to //false// if you don't use a database. Possible values: //// Default: //true// ====env_name > .settings > escaping_strategy==== Determines if the output escaper sub-framework is enabled. The output escaper determines how variables are made available to templates. When enabled, all variables made available in the templates are automatically escaped by calling the helper function defined by the //escaping_method// attribute in settings.yml file. Possible values: //// Default: //false// ====env_name > .settings > escaping_method==== Function or helper used for escaping variables in templates. You can choose one of the built-in values or create your own function. Possible values: //// Default: //ESC_SPECIALCHARS// ====env_name > .settings > charset==== Defines the charset that will be used everywhere in the framework: from the response //Content-Type// header, to the output escaping feature. This setting is used in many different places in the framework, and so its value is cached in several places. After changing it, the configuration cache must be cleared, even in the development environment. Default: //utf-8// ====env_name > .settings > csrf_secret==== Defines a randomly generated unique secret to enable CSRF protection or //false// to disable. If not set to //false//, it enables CSRF protection for all forms defined with the form framework. Default: //false// ====env_name > .settings > enabled_modules==== Defines an array of module names to enable for this application. Modules defined in plugins or in the symfony core are not enabled by default, and must be listed in this setting to be accessible. The //default// module defined in the framework contains all the default actions set in the //.actions// sub-section of //settings.yml//. Default: //[default]// ====env_name > .settings > standard_helpers==== Defines an array of helpers included in all templates by default. Default: //[Partial, Cache]// ====env_name > .settings > cache==== Specifies whether or not to enable the template cache. Possible values: //// Default: //false// ====env_name > .settings > etag==== Specifies whether or not to enable etag handling. The //etag// setting enables or disables the automatic generation of //ETag// HTTP headers. The ETag generated by symfony is a simple md5 of the response content. This option takes effect only when //client_lifetime// in //cache.yml // is set to //0//. Possible values: //// Default: //true// ====env_name > .settings > i18n==== Specifies whether or not to enable interface translation handled by i18n sub-framework. Set to false if your application should not be translated. If your application is internationalized, then enable the internationalization layer of symfony, by setting the //i18n// setting to //true//. Possible values: //// Default: //false// ====env_name > .settings > default_culture==== Defines the default user culture used by the i18n sub-framework. The culture is the combination of the language and the country of the user. For instance, the culture for a user that speaks French is //fr// and the culture for a user from France is //fr_FR//. The language is coded in two lowercase characters, according to the ISO 639-1 standard, and the country is coded in two uppercase characters, according to the ISO 3166-1 standard. Default: //en// ====env_name > .settings > no_script_name==== Determines whether or not the front controller script name is prepended to generated URLs. By default, it is set to //true// by the //generate:app// task for the //prod// environment of the first application created. Only one application and environment can have this setting set to //true// if all front controllers are in the same directory (web/). If you want more than one application with //no_script_name// set to //true//, move the corresponding front controller(s) under a sub-directory of the web root directory. Possible values: //// Default: //false// ====env_name > .settings > logging_enabled==== Specifies whether logging is enabled. Setting it to //false// bypasses the logging mechanism completely and provides a small performance gain. Possible values: //// Default: //true// ====env_name > .settings > web_debug==== Specifies whether to enable the web debug toolbar. If set to //true// and the response content type is HTML, the web debug toolbar is injected into a page. Possible values: //// Default: //false// ====env_name > .settings > file_link_format==== Format used to make file paths clickable. In the debug message, file paths are clickable links if the //sf_file_link_format// or if the //xdebug.file_link_format// PHP configuration value is set. For example, if you want to open files in TextMate, you can use the following value: txmt://open?url=file://%f&line=%l The //%f// placeholder will be replaced with file's absolute path and the //%l// placeholder will be replaced with the line number. Default: //~ (none)// ====env_name > .settings > error_reporting==== Defines the level of PHP error reporting (to be displayed in the browser and written to the logs). Defaults depending on environment: * //prod//: E_PARSE | E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR | E_USER_ERROR * //dev//: E_ALL | E_STRICT * //test//: (E_ALL | E_STRICT) ^ E_NOTICE Default: //// ====env_name > .settings > compressed==== Specifies whether enable native PHP response compression. If set to //true//, symfony will use //ob_gzhandler// as a callback function for //ob_start()//. It is recommended to keep it to //false//. Possible values: //// Default: //false// ==== check_lock ==== ** env_name > .settings > check_lock ** Specifies whether or not to enable the application lock system triggered by the //clear-cache// and //disable// tasks. Set to //true// to have all requests to disabled applications redirected to the sfConfig::get('sf_symfony_lib_dir')/exception/data/unavailable.php page. Possible values: //// Default: //false// ==== default_timezone ==== ** env_name > .settings > default_timezone ** Defines the default timezone used by PHP. It can be any timezone recognized by PHP. If you don't define a timezone neither in //settings.yml// or in the //php.ini// file, symfony will try to guess the best timezone by calling the //date_default_timezone_get()// PHP function. ====env_name > .settings > admin_web_dir==== Sets the web path to the common pages assets (images, stylesheets, and JavaScript files). Default: ///sf/sf_admin// ====env_name > .settings > web_debug_web_dir==== Sets the web path to the web debug toolbar assets (images, stylesheets, and JavaScript files). Default: ///sf/sf_web_debug// ====env_name > .settings > custom_setting==== You can add your custom setting in //settings.yml// file. For example, if you add setting "my_setting", all: .settings: ... my_setting: "my value" then you can access it from anywhere in the code like this: $my_value = sfConfig::get('sf_my_setting'); // remember to prefix 'sf_' to your setting name