====== Symfony YAML Configuration Reference ======
=====The factories.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]].
Factories are core objects needed by the framework during the life of any request. They are configured in the //factories.yml// configuration file and always accessible via the //sfContext// object:
// get the user factory
sfContext::getInstance()->getUser();
The main //factories.yml// configuration file for an application can be found in the //apps/APP_NAME/config/// directory.
# General configuration
env_name:
factory_name:
class: class_name
file: absolute_path_to_file
param: array_of_parameters
env_name:
# Mailer factory configuration
mailer:
class: sfMailer
param:
logging:
charset: charset_name
delivery_strategy:
delivery_address: email
spool_class:
spool_arguments:
transport:
class:
param:
# Swift_SmtpTransport class
host: smtp_host
port: smtp_port
encryption:
username: username
password: password
# Swift_SendmailTransport class
command: sendmail_command
# Request factory configuration
request:
class: sfWebRequest
param:
logging:
path_info_array: global_php_array
path_info_key: key_name
relative_url_root: part_of_the_url
default_format: format_name
formats:
file_extension: content_types
# Response factory configuration
response:
class: sfWebResponse
param:
logging:
send_http_headers:
http_protocol: http_protocol_version
charset: charset_name
content_type: content_type_name
# User factory configuration
user:
class: myUser
param:
logging:
auto_shutdown:
default_culture: culture_name
use_flash:
# sfBasicSecurityUser class
timeout: timeout_in_seconds
# Storage factory configuration
storage:
class: class_name
param:
auto_shutdown:
# sfSessionStorage class
session_name: cookie_name
session_id: session_id_value
auto_start:
session_cookie_lifetime: lifetime_in_seconds
session_cookie_path: cookie_path
session_cookie_domain: cookie_domain
session_cookie_secure:
session_cookie_httponly:
session_cache_limiter:
# sfDatabaseSessionStorage class
database: database_name
db_table: table_name
db_id_col: session_id_column
db_data_col: session_data_column
db_time_col: session_time_column
# sfCacheSessionStorage class
cache: anonymous_cache_factory
# sfSessionTestStorage class
session_path: session_path_string
# View cache manager factory configuration
view_cache_manager:
class: sfViewCacheManager
param:
cache_key_use_vary_headers:
cache_key_use_host_name:
# View cache factory configuration
view_cache:
class: class_name
param:
lifetime: lifetime_in_seconds
automatic_cleaning_factor: integer_value
prefix: cash_key_prefix
# sfFileCache class
cache_dir: path_to_directory
# sfSQLiteCache class
database: sqlite_db_name
# sfMemcacheCache class
host: memcache_host
port: memcache_port
persistent:
servers: array_of_servers
# I18n factory configuration
i18n:
class: sfI18N
param:
source:
debug:
untranslated_prefix: prefix_string
untranslated_suffix: suffix_string
cache: anonymous_cache_factory
# Routing factory configuration
routing:
class: sfPatternRouting
param:
logging:
variable_prefixes: [prefix1, prefix2, ...]
segment_separators: [seperator1, seperator2, ...]
generate_shortest_url:
extra_parameters_as_query_string:
cache: anonymous_cache_factory
suffix: suffix_string
load_configuration:
lazy_routes_deserialize:
lookup_cache_dedicated_keys:
variable_regex: regular_expression
debug:
default_module: module_name
default_action: action_name
# Logger factory configuration
logger:
class: class_name
param:
level:
# sfWebDebugLogger class
web_debug_class: class_name
# sfFileLogger class
file: file_path
format: log_line_format
type: type_string
time_format: strftime_format
dir_mode: dir_mode
file_mode: file_mode
# sfVarLogger class
xdebug_logging:
# sfStreamLogger class
stream: php_stream
# sfAggregateLogger class
loggers: array_of_loggers
# Controller factory configuration
controller:
class: sfFrontWebController
=====General configuration=====
====env_name====
The //factories.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.
==== factory_name ====
** env_name > factory_name **
Defines a factory name.
The //factories.yml// configuration file contains a list of named factories:
FACTORY_1:
# definition of factory 1
FACTORY_2:
# definition of factory 2
# ...
The supported factory names are: //controller//, //logger//, //i18n//, //request//, //response//, //routing//, //storage//, //user//, //view_cache//, and //view_cache_manager//.
==== class ====
** env_name > factory_name > class **
Defines a factory class, which is used to create factory object.
When the //sfContext// initializes the factories, it reads the //factories.yml// file for the class name of the factory (//class//) and the parameters (see //param// option) used to configure the factory object.
Being able to customize the factories means that you can use a custom class for symfony core objects instead of the default one. You can also change the default behavior of these classes by customizing the parameters sent to them.
==== file ====
** env_name > factory_name > file **
Defines an absolute path to a //class// file.
If the factory class cannot be autoloaded, a //file// path can be defined and will be automatically included before the factory is created.
==== param ====
** env_name > factory_name > param **
Defines an array of options used to configure factory object. These options are passed as an array to the constructor of a factory class.
=====Mailer factory configuration=====
==== mailer ====
** env_name > mailer **
This factory is used to configure //mailer// core object.
//sfContext// Accessor: //$context->getMailer()//.
====env_name > mailer > class====
** env_name > mailer > class **
//sfMailer// class is the main entry point for the mailer system.
Default: //sfMailer//
====Parameters====
==== logging ====
** env_name > mailer > param > logging **
Specifies whether to enable logging or not. By default, it uses the //logging_enabled// setting from //settings.yml//.
Possible values: ////
Default: //%SF_LOGGING_ENABLED%//
====charset ====
** env_name > mailer > param > charset **
Defines the charset to use for the mail messages. By default, it uses the //charset// setting from //settings.yml//.
Default: //%SF_CHARSET%//
==== delivery_strategy ====
** env_name > mailer > param > delivery_strategy **
Defines how email messages are delivered by the mailer. Four strategies are available by default, which should suit all the common needs:
* //realtime// - messages are sent in realtime;
* //single_address// - messages are sent to a single address;
* //spool// - messages are stored in a queue;
* //none// - messages are simply ignored.
Possible values: ////
==== delivery_address ====
** env_name > mailer > param > delivery_address **
Defines the recipient of all message when the //delivery_strategy// is set to //single_address//.
==== spool_class ====
** env_name > mailer > param > spool_class **
Defines the spool class to use when the //delivery_strategy// is set to //spool//:
* //Swift_FileSpool// - messages are stored on the filesystem;
* //Swift_DoctrineSpool// - messages are stored in a Doctrine model;
* //Swift_PropelSpool// - messages are stored in a Propel model.
When the spool is instantiated, the //spool_arguments// option is used as the constructor arguments.
====env_name > mailer > param > spool_arguments====
Defines the constructor arguments of the spool. Here are the options available for the built-in queues classes:
//Swift_FileSpool//:
* The absolute path of the queue directory (messages are stored in this directory).
//Swift_DoctrineSpool//:
* The Doctrine model to use to store the messages (//MailMessage// by default);
* The column name to use for message storage (//message// by default);
* The method to call to retrieve the messages to send (optional).
//Swift_PropelSpool//:
* The Propel model to use to store the messages (//MailMessage// by default);
* The column name to use for message storage (//message// by default);
* The method to call to retrieve the messages to send (optional). It receives the current Criteria as an argument.
The configuration below shows a typical configuration for a Doctrine spool:
mailer:
class: sfMailer
param:
delivery_strategy: spool
spool_class: Swift_DoctrineSpool
spool_arguments: [ MailMessage, message, getSpooledMessages ]
====Transport configuration====
====env_name > mailer > param > transport====
Defines the transport for the mailer. A transport is the component which actually does the sending.
====env_name > mailer > param > transport > class====
Defines the transport class. The //class// setting can be any class that implements from //Swift_Transport//, and four are provided by default:
* //Swift_SmtpTransport// - uses a SMTP server to send messages. It can deal with encryption and authentication;
* //Swift_SendmailTransport// - uses sendmail to send messages;
* //Swift_MailTransport// - uses the native PHP mail() function to send messages;
* //Swift_NullTransport// - disables the transport altogether (useful with the //none// strategy to bypass the connection to the mail server).
Default: //Swift_SmtpTransport//
====env_name > mailer > param > transport > param====
Defines an array of parameters to configure the transport. The "Transport Types" section of the Swift Mailer official documentation describes all you need to know about the built-in transport classes and their different parameters.
The default configuration:
mailer:
class: sfMailer
param:
...
transport:
class: Swift_SmtpTransport
param:
host: localhost
port: 25
encryption: ~
username: ~
password: ~
====env_name > mailer > param > transport > param > host====
Specifies SMTP server host.
====env_name > mailer > param > transport > param > port====
Specifies SMTP server port.
Default: //25//
====env_name > mailer > param > transport > param > encryption====
Specifies the encryption used to connect to SMTP server.
Note: For SSL or TLS encryption to work your PHP installation must have appropriate OpenSSL transports wrappers. You can check if "tls" and/or "ssl" are present in your PHP installation by using the PHP function //stream_get_transports()//.
Possible values: ////
====env_name > mailer > param > transport > param > username====
Specifies the username used to connect to SMTP server.
====env_name > mailer > param > transport > param > password====
Specifies the password used to connect to SMTP server.
====env_name > mailer > param > transport > param > command====
Specifies the command used to call sendmail.
Default: ///usr/sbin/sendmail -bs//
=====Request factory configuration=====
====env_name > request====
This factory is used to configure //request// core object.
//sfContext// Accessor: //$context->getRequest()//.
====env_name > request > class====
Defines PHP class used to create http request instance. Must extend //sfRequest// abstract class.
//sfWebRequest// class provides methods for manipulating client request information such as attributes, and parameters. It parses input from the request and store them as parameters. It is also possible to manipulate the request method originally sent by the user.
Default: //sfWebRequest//
====Parameters====
====env_name > request > param > logging====
Specifies whether to enable logging or not. By default, it uses the //logging_enabled// setting from //settings.yml//.
Possible values: ////
Default: //%SF_LOGGING_ENABLED%//
====env_name > request > param > path_info_array====
Defines the global PHP array that will be used to retrieve information. On some configurations you may want to change the default //SERVER// value to //ENV//.
Default: //SERVER//
====env_name > request > param > path_info_key====
Defines the key under which the //PATH_INFO// information can be found.
If you use IIS with a rewriting module like //IIFR// or //ISAPI//, you may need to change this value to //HTTP_X_REWRITE_URL//.
Default: //PATH_INFO//
====env_name > request > param > relative_url_root====
Defines the part of the URL before the front controller. Most of the time, this is automatically detected by the framework and does not need to be changed.
====env_name > request > param > default_format====
Defines the default format (file extension) to use for the response. The available formats are defined in the //formats// option below.
====env_name > request > param > formats====
Defines an array of file extensions and their corresponding //Content-Type//s. It is used by the framework to automatically manage the //Content-Type// of the response, based on the request URI extension.
====env_name > request > param > formats > file_extension====
Defines file extension and its corresponding Content-Type.
By default there are preconfigured some of the formats:
request:
class: sfWebRequest
param:
...
formats:
txt: text/plain
js: [application/javascript, application/x-javascript, text/javascript]
css: text/css
json: [application/json, application/x-json]
xml: [text/xml, application/xml, application/x-xml]
rdf: application/rdf+xml
atom: application/atom+xml
=====Response factory configuration=====
====env_name > response====
This factory is used to configure //response// core object.
//sfContext// Accessor: //$context->getResponse()//.
====env_name > response > class====
Defines PHP class used to create http response instance. Must extend //sfResponse// abstract class.
//sfWebResponse// class manages web reponses and provides methods for manipulating client response information such as headers, cookies and content.
Default: //sfWebResponse//
====Parameters====
====env_name > response > param > logging====
Specifies whether to enable logging or not. By default, it uses the //logging_enabled// setting from //settings.yml//.
Possible values: ////
Default: //%SF_LOGGING_ENABLED%//
====env_name > response > param > send_http_headers====
Specifies whether the response should send HTTP response headers along with the response content. This setting is mostly useful for testing, as headers are sent with the //header()// PHP function which sends warnings if you try to send headers after some output.
Possible values: ////
Default: //true//
====env_name > response > param > http_protocol====
Defines the HTTP protocol version to use for the response. By default, it checks the //$_SERVER['SERVER_PROTOCOL']// value if available or defaults to //HTTP/1.0//.
Default: //HTTP/1.0//
====env_name > response > param > charset====
Defines the charset to use for the response. By default, it uses the //charset// setting from //settings.yml//, which is what you want most of the time.
Default: //%SF_CHARSET%//
====env_name > response > param > content_type====
Defines the content type.
Default: //text/html//
=====User factory configuration=====
====env_name > user====
This factory is used to configure //user// core object.
//sfContext// Accessor: //$context->getUser()//.
====env_name > user > class====
Defines PHP class used to create user instance. Must extend //sfUser// class.
Built-in user classes:
* //sfUser// - wraps a client session and provides accessor methods for user attributes. It also makes storing and retrieving multiple page form data rather easy by allowing user attributes to be stored in namespaces, which help organize data;
* //sfBasicSecurityUser// - extends //sfUser// class by providing advanced security manipulation methods.
By default, the default //myUser// class inherits from //sfBasicSecurityUser//, which can be configured in the //security.yml// configuration file.
Default: //myUser//
====Parameters====
====env_name > user > param > logging====
Defines whether to enable logging.
This option is available for all user classes.
Possible values: ////
Default: //false//
====env_name > user > param > auto_shutdown====
Defines whether to automatically save the changes to the session.
This option is available for all user classes.
Possible values: ////
Default: //true//
====env_name > user > param > default_culture====
Defines the default culture to use for a user who comes to the site for the first time. By default, it uses the //default_culture// setting from //settings.yml//, which is what you want most of the time.
This option is available for all user classes.
Default: //%SF_DEFAULT_CULTURE%//
====env_name > user > param > use_flash====
Defines whether to enable the flash component.
This option is available for all user classes.
Possible values: ////
Default: //false//
====env_name > user > param > timeout====
Defines the timeout for user authentication. It is not related to the session timeout. The default setting automatically unauthenticates a user after 30 minutes of inactivity.
This setting is only used by user classes that inherit from the //sfBasicSecurityUser// base class, which is the case of the generated //myUser// class.
Default: //1800//
=====Storage factory configuration=====
====env_name > storage====
This factory is used to configure //storage// core object.
//sfContext// Accessor: //$context->getStorage()//.
The storage factory is used by the user factory to persist user data between HTTP requests.
====env_name > storage > class====
Defines PHP class used to create storage instance. Must extend //sfStorage// abstract class which allows you to customize the way symfony stores its persistent data.
Built-in storage classes:
* //sfSessionStorage// - allows you to store persistent symfony data in the user session;
* //sfSessionTestStorage// - is a fake sfSessionStorage implementation to allow easy testing;
* //sfMySQLSessionStorage// - provides support for session storage using a MySQL brand database;
* //sfMySQLiSessionStorage// - Provides support for session storage using a MySQL brand database using the MySQL improved API;
* //sfPostgreSQLSessionStorage// - provides support for session storage using a PostgreSQL brand database;
* //sfPDOSessionStorage// - provides support for session storage using a PDO database abstraction layer;
* //sfCacheSessionStorage// - This class stores the session data in via sfCache instance and with an id issued in a signed cookie. Useful when you don't want to store the session;
* //sfNoStorage// - allows you to disable session support.
Default: //sfSessionStorage//
====Parameters====
====env_name > storage > param > auto_shutdown====
Defines whether to automatically save the changes to the session.
This option is available for all storage classes.
Possible values: ////
Default: //true//
====env_name > storage > param > session_name====
Defines the name of the cookie used by symfony to store the user session. By default, the name is //symfony//, which means that all your applications share the same cookie (and as such the corresponding authentication and authorizations).
This option is available for //sfSessionStorage//, //sfCacheSessionStorage// and database storage classes.
Default: //symfony//
====env_name > storage > param > session_id====
Defines the session identifier.
This option is available for //sfSessionStorage//, //sfSessionTestStorage// and database storage classes.
If you define this option for //sfSessionStorage// or database storage classes, //session_id// value will be assigned to a session only if //session.use_cookies// setting in your php.ini is set to //false//.
Default: //null//
====env_name > storage > param > auto_start====
Enables or disables the session auto-starting feature of PHP (via the session_start() function).
This option is available only for //sfSessionStorage// and database storage classes.
Possible values: ////
Default: //true//
====env_name > storage > param > session_cookie_lifetime====
Specifies the lifetime of the cookie in seconds which is sent to the browser. The value 0 means "until the browser is closed."
Note that the expiration timestamp is set relative to the server time, which is not necessarily the same as the time in the client's browser.
This option is available for //sfSessionStorage//, //sfCacheSessionStorage// and database storage classes.
Default: //0//
====env_name > storage > param > session_cookie_path====
Specifies path to set in the session cookie.
This option is available for //sfSessionStorage//, //sfCacheSessionStorage// and database storage classes.
Default: /////
====env_name > storage > param > session_cookie_domain====
Specifies the domain to set in the session cookie. Default is none at all meaning the host name of the server which generated the cookie according to cookies specification.
This option is available for //sfSessionStorage//, //sfCacheSessionStorage// and database storage classes.
====env_name > storage > param > session_cookie_secure====
Specifies whether cookies should only be sent over secure connections.
This option is available for //sfSessionStorage//, //sfCacheSessionStorage// and database storage classes.
Default: //false//
====env_name > storage > param > session_cookie_httponly====
Marks the cookie as accessible only through the HTTP protocol. This means that the cookie won't be accessible by scripting languages, such as JavaScript. This setting can effectively help to reduce identity theft through XSS attacks (although it is not supported by all browsers).
This option is available for //sfSessionStorage//, //sfCacheSessionStorage// and database storage classes.
Possible values: ////
Default: //false//
====env_name > storage > param > session_cache_limiter====
Specifies the cache control method used for session pages. See also the //session_cache_limiter()// documentation for information about what available values mean.
If the //session_cache_limiter// option is set to //null// (which is the default), the session cache limiter value will be set by PHP automatically according to the php.ini configuration file. For all other values, PHP's //session_cache_limiter()// function is called and the option value is passed as an argument.
This option is available only for //sfSessionStorage// and database storage classes.
Default: //null//
====env_name > storage > param > database====
Defiens the name of database in which session data will be stored.
This option is available for database storage classes which extends //sfDatabaseSessionStorage// abstract class.
====env_name > storage > param > db_table====
Defiens the database table in which session data will be stored.
This option is available for database storage classes which extends //sfDatabaseSessionStorage// abstract class.
====env_name > storage > param > db_id_col====
Defines the database column in which the session id will be stored.
This option is available for database storage classes which extends //sfDatabaseSessionStorage// abstract class.
Default: //sess_id//
====env_name > storage > param > db_data_col====
Defines the database column in which the session data will be stored.
This option is available for database storage classes which extends //sfDatabaseSessionStorage// abstract class.
Default: //sess_data//
====env_name > storage > param > db_time_col====
Defines the database column in which the session timestamp will be stored.
This option is available for database storage classes which extends //sfDatabaseSessionStorage// abstract class.
Default: //sess_time//
====env_name > storage > param > cache====
Defines an anonymous cache factory to be used for caching session data (see the //view_cache// factory for more information), eg.:
storage:
class: sfCacheSessionStorage
param:
...
cache:
class: sfFileCache
param:
automatic_cleaning_factor: 0
cache_dir: %SF_I18N_CACHE_DIR%
lifetime: 31556926
prefix: %SF_APP_DIR%/i18n
This option is available only for //sfCacheSessionStorage// class.
====env_name > storage > param > session_path====
Defines the path to store the session files.
This option is available only for //sfSessionTestStorage// class.
=====View cache manager factory configuration=====
====env_name > view_cache_manager====
This factory is used to configure //view cache manager// core object.
//sfContext// Accessor: //$context->getViewCacheManager()//.
This factory is only created if the //cache// setting in //settings.yml// file is set to //true//.
Most configuration of this factory is done via the //view_cache// factory, which defines the underlying cache object used by the view cache manager.
====env_name > view_cache_manager > class====
//sfViewCacheManager// is a cache class to cache the HTML results for actions and templates. This class uses a sfCache instance implementation to store cache.
Default: //sfViewCacheManager//
====Parameters====
====env_name > view_cache_manager > param > cache_key_use_vary_headers====
Specifies if the cache keys should include the vary headers part. In practice, it says if the page cache should be HTTP header dependent, as specified in //vary// cache parameter.
Possible values: ////
Default: //true//
====env_name > view_cache_manager > param > cache_key_use_host_name====
Specifies if the cache keys should include the host name part. In practice, it says if page cache should be hostname dependent.
Possible values: ////
Default: //true//
=====View cache factory configuration=====
====env_name > view_cache====
This factory is used to configure //view cache// core object.
It does not have //sfContext// any accessor, it is used directly by the //view_cache_manager// factory.
This factory is only defined if the //cache// setting in //settings.yml// file is set to //true//.
The //view_cache// factory defines a cache class that must inherit from //sfCache//.
Anonymous Cache Factories
Several factories (//view_cache//, //i18n//, and //routing//) can take advantage of a cache object if defined in their configuration. The configuration of the cache object is similar for all factories. The //cache// key defines an anonymous cache factory. Like any other factory, it takes a //class// and a //param// entries. The //param// entry can take any option available for the given cache class.
====env_name > view_cache > class====
Defines PHP class used to create view cache object instance. Must extend //sfCache// abstract class.
Built-in logger classes:
* //sfAPCCache// - cache class that stores cached content in APC;
* //sfEAcceleratorCache// - cache class that stores cached content in EAccelerator;
* //sfFileCache// - cache class that stores content in files;
* //sfMemcacheCache// - cache class that stores cached content in memcache;
* //sfSQLiteCache// - cache class that stores cached content in a SQLite database;
* //sfXCacheCache// - cache class that stores cached content in XCache;
* //sfNoCache// - Cache class that does nothing.
Default: //sfFileCache//
====Parameters====
====env_name > view_cache > param > lifetime====
Defines the default life time in seconds.
This option is available for all cache drivers.
Default: //86400//
====env_name > view_cache > param > automatic_cleaning_factor====
The automatic cleaning process destroy too old (for the given life time) cache files when a new cache file is written.
* //0// - no automatic cache cleaning;
* //1// - systematic cache cleaning;
* //x (integer) > 1// - automatic cleaning randomly 1 times on x cache write.
This option is available for all cache drivers.
Default: //1000//
====env_name > view_cache > param > prefix====
Defines a prefix added to every cache key. It allows to share or separate a cache between different environments/applications/projects. Use the environment in the prefix to use different cache depending on the environment. Use the same prefix for two applications if you want their cache to be shared.
This option is available for all cache drivers.
====env_name > view_cache > param > cache_dir====
Defines the directory where to put cache files.
This option is available only for //sfFileCache// class.
====env_name > view_cache > param > database====
Defines the file where to put the cache database (or //:memory:// to store cache in memory).
This option is available only for //sfSQLiteCache// class.
====env_name > view_cache > param > host====
Defines host for the default Memcached server.
This option is only available for //sfMemcacheCache// class.
Default: //localhost//
====env_name > view_cache > param > port====
Defines port for the default Memcached server.
This option is only available for //sfMemcacheCache// class.
Default: //11211//
====env_name > view_cache > param > persistent====
Defines whether the connection to Memcached must be persistent or not.
This option is only available for //sfMemcacheCache// class.
Possible values: ////
Default: //true//
====env_name > view_cache > param > servers====
Defines an array of additional servers (keys: host, port, persistent). See //host//, //port// and //persistent// options above.
This option is only available for //sfMemcacheCache// class.
=====I18n factory configuration=====
====env_name > i18n====
This factory is used to configure //i18n// core object.
//sfContext// Accessor: //$context->getI18N()//.
This factory is only defined if the //i18n// setting in the //settings.yml// file is set to //true//.
====env_name > i18n > class====
//sfI18N// class wraps the core i18n classes for a symfony context.
Default: //sfI18N//
====Parameters====
====env_name > i18n > param > source====
Defines the container type for translations.
Possible values: ////
====env_name > i18n > param > debug====
Sets the debugging mode. If set to //true//, un-translated messages are decorated with a prefix and a suffix (see //untranslated_prefix// and //untranslated_suffix// options below).
Possible values: ////
Default: //false//
====env_name > i18n > param > untranslated_prefix====
Defines a prefix to used for un-translated messages.
Default: //"[T]"//
====env_name > i18n > param > untranslated_suffix====
Defines a suffix to used for un-translated messages.
Default: //"[/T]"//
====env_name > i18n > param > cache====
Defines a anonymous cache factory to be used for caching i18n data (see the //view_cache// factory for more information), eg.:
i18n:
class: sfI18N
param:
...
cache:
class: sfFileCache
param:
automatic_cleaning_factor: 0
cache_dir: %SF_I18N_CACHE_DIR%
lifetime: 31556926
prefix: %SF_APP_DIR%/i18n
=====Routing factory configuration=====
====env_name > routing====
This factory is used to configure //routing// core object.
//sfContext// Accessor: //$context->getRouting()//.
====env_name > routing > class====
//sfPatternRouting// class controls the generation and parsing of URLs.
Default: //sfPatternRouting//
====Parameters====
====env_name > routing > param > logging====
Specifies whether to enable logging. By default this option is equal to the one set in //logging_enabled// option in //settings.yml// file.
Possible values: ////
Default: //%SF_LOGGING_ENABLED%//
====env_name > routing > param > variable_prefixes====
Defines the list of characters that starts a variable name in a route pattern.
Default: //[:]//
====env_name > routing > param > segment_separators====
Defines the list of route segment separators. Most of the time, you don't want to override this option for the whole routing, but for specific routes.
Default: //[/, .]//
====env_name > routing > param > generate_shortest_url====
Specifies whether to generate the shortest URL possible. If set to //true//, this option will tell the routing system to generate the shortest route possible by omitting empty route variables in the end of the URL. For example if you have this URL pattern:
/users/:username/:sort/:start/
the //:username// is set to //'test1'// and the other two variables (//:sort// and //:start//) are left unset, but have default values defined, then the routing system will generate this URL:
/users/test1/
Set //generate_shortest_url// to //false// if you want your routes to be backward compatible with symfony 1.0 and 1.1.
Possible values: ////
Default: //true//
====env_name > routing > param > extra_parameters_as_query_string====
When some parameters are not used in the generation of a route, this option allows those extra parameters to be converted to a query string. Set it to //false// to fallback to the behavior of symfony 1.0 or 1.1. In those versions, the extra parameters were just ignored by the routing system.
Possible values: ////
Default: //true//
====env_name > routing > param > cache====
Defines an anonymous cache factory to be used for caching routing configuration and data (see the //view_cache// factory for more information), eg.:
routing:
class: sfPatternRouting
param:
...
cache:
class: sfFileCache
param:
automatic_cleaning_factor: 0
cache_dir: %SF_I18N_CACHE_DIR%
lifetime: 31556926
prefix: %SF_APP_DIR%/i18n
====env_name > routing > param > suffix====
The default suffix to use for all routes. This option is deprecated and is not useful anymore.
Default: //Empty string//
====env_name > routing > param > load_configuration====
Defines whether the routing.yml files must be automatically loaded and parsed. Set it to //false// if you want to use the routing system of symfony outside of a symfony project.
Possible values: ////
Default: //true//
====env_name > routing > param > lazy_routes_deserialize====
If set to //true//, this setting enables lazy unserialization of the routing cache. It can improve the performance of your applications if you have a large number of routes and if most matching routes are among the first ones. It is strongly advised to test the setting before deploying to production, as it can harm your performance in certain circumstances.
Possible values: ////
Default: //false//
====env_name > routing > param > lookup_cache_dedicated_keys====
Determines how the routing cache is constructed. When set to //false//, the cache is stored as one big value; when set to //true//, each route has its own cache store. This setting is a performance optimization setting.
As a rule of thumb, setting this to //false// is better when using a file-based cache class (sfFileCache for instance), and setting it to //true// is better when using a memory-based cache class (sfAPCCache for instance).
Possible values: ////
Default: //false//
====env_name > routing > param > variable_regex====
Defines regular expression used to adjust the characters allowed in your variable names.
Default: //[\w\d_]+//
====env_name > routing > param > debug====
Specifies whether to enable caching or not. By default this option is equal to the one set in //debug// option in //settings.yml// file.
Possible values: ////
Default: //%SF_DEBUG%//
====env_name > routing > param > default_module====
Defines the default module name.
Default: //default//
====env_name > routing > param > default_action====
Defines the default action name.
Default: //index//
=====Logger factory configuration=====
====env_name > logger====
This factory is used to configure //logger// core object.
//sfContext// Accessor: //$context->getLogger()//.
If you don't use the //sfAggregateLogger//, don't forget to specify a //null// value for the //loggers// parameter.
This factory is always defined, but the logging only occurs if the //logging_enabled// setting in //settings.yml// file is set to //true//.
====env_name > logger > class====
Defines PHP class used to create logger instance. Must extend //sfLogger// abstract class.
Built-in logger classes:
* //sfAggregateLogger// - logs messages through several loggers;
* //sfWebDebugLogger// - logs messages into the web debug toolbar;
* //sfConsoleLogger// - logs messages to the console;
* //sfFileLogger// - logs messages in a file;
* //sfStreamLogger// - logs messages to a PHP stream;
* //sfVarLogger// - logs messages within its instance for later use;
* //sfNoLogger// - is a noop logger.
Default: //sfAggregateLogger//
====Parameters====
====env_name > logger > param > level====
Defines the level of the logger. This parameter is available for all logger classes as it is used by //sfLogger// abstract class. Available levels:
* //emerg// - system is unusable;
* //alert// - immediate action required;
* //crit// - critical conditions;
* //err// - error conditions;
* //warning// - warning conditions;
* //notice// - normal but significant;
* //info// - informational;
* //debug// - debug-level messages.
Possible values: ////
====env_name > logger > param > web_debug_class====
Defines the web debug class.
This option is only available for //sfWebDebugLogger// class.
Default: //sfWebDebug//
====env_name > logger > param > file====
The file path or a php wrapper to log messages. You can use any supported php wrapper, eg. to write logs to the Apache error log, use //php://stderr//.
This option is only available for //sfFileLogger// class.
====env_name > logger > param > format====
Defines the log line format.
This option is only available for //sfFileLogger// class.
Default: //%time% %type% [%priority%] %message%%EOL%//
====env_name > logger > param > type====
Defines the string which replaces %type% placeholder in the log line format. See //format// option above.
This option is only available for //sfFileLogger// class.
Default: //symfony//
====env_name > logger > param > time_format====
Defines the log time strftime format.
This option is only available for //sfFileLogger// class.
Default: //%b %d %H:%M:%S//
====env_name > logger > param > dir_mode====
Defines the mode to use when creating a directory.
This option is only available for //sfFileLogger// class.
Default: //0777//
====env_name > logger > param > file_mode====
Defines the mode to use when creating a file.
This option is only available for //sfFileLogger// class.
Default: //0666//
====env_name > logger > param > xdebug_logging====
Defines whether to add xdebug trace to the logs.
This option is only available for //sfVarLogger// class.
Possible values: ////
Default: //false//
====env_name > logger > param > stream====
Defines a PHP stream.
This option is only available for //sfStreamLogger// class.
helper
====env_name > logger > param > loggers====
Defines an array of logger objects that extends //sfLogger//.
This option is only available for //sfAggregateLogger// class. Eg.:
logger:
class: sfAggregateLogger
param:
level: debug
loggers:
sf_web_debug:
class: sfWebDebugLogger
param:
level: debug
condition: %SF_WEB_DEBUG%
xdebug_logging: false
web_debug_class: sfWebDebug
sf_file_debug:
class: sfFileLogger
param:
level: debug
file: %SF_LOG_DIR%/%SF_APP%_%SF_ENVIRONMENT%.log
=====Controller factory configuration=====
==== env_name > controller ====
This factory is used to configure //controller// core object.
//sfContext// Accessor: //$context->getController()//.
==== env_name > controller > class ====
//sfFrontWebController// allows you to centralize your entry point in your web application, but at the same time allow for any module and action combination to be requested. This class does not take any options.
Default: //sfFrontWebController//