====== Symfony YAML Configuration Reference ======
=====The filters.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 //filters.yml// configuration file describes the filter chain to be executed for every request. The main filters.yml configuration file for an application can be found in the //apps/APP_NAME/config/// directory.
The filters.yml configuration file contains a list of named filter definitions:
FILTER_1:
# definition of filter 1
FILTER_2:
# definition of filter 2
# ...
When the controller initializes the filter chain for a request, it reads the //filters.yml// file and registers the filters by looking for the class name of the filter (//class//) and the parameters (//param//) used to configure the filter object.
filter_name:
class: class_name
param: array_of_parameters
=====Filter configuration options=====
====filter_name====
Specifies the name of the filter. By default there are configured four filters: //rendering//, //security//, //cache// and //execution//. When you override the //filters.yml// file, you must keep all filters from the inherited configuration file:
rendering: ~
security: ~
cache: ~
execution: ~
The filters are executed in the same order as they appear in the configuration file. As symfony executes the filters as a chain, the first registered filter is executed first and last. The //rendering// filter should always be the first registered filter and the //execution// filter should be the last one.
The //rendering// is a mandatory filter and is responsible for the output of the response to the browser.
The //security// filter checks the security by calling the //getCredential()// method of the action. Once the credential has been acquired, it verifies that the user has the same credential by calling the //hasCredential()// method of the user object.
The //cache// filter manages the caching of actions and pages. It is also responsible for adding the needed HTTP cache headers to the response (//Last-Modified//, //ETag//, //Cache-Control//, //Expires//, ...)
The //execution// filter a mandatory one. It is at the center of the filter chain and does all action and view execution.
====filter_name > class====
Specifies the filter class name. This //class// should extend the sfFilter base class. Here is the list of classes used in default configuration:
* //sfRenderingFilter// for the rendering filter;
* //sfBasicSecurityFilter// for the security filter;
* //sfCacheFilter// for the cache filter;
* //sfExecutionFilter// for the execution filter.
====filter_name > param====
Specifies an array of parameters used to configure the filter object. Some of the filters are identified with the type parameter:
* //rendering// type for the rendering filter;
* //execution// type for the execution filter;
* //security// type for the security filter.
Eg.:
rendering:
class: sfRenderingFilter
param:
type: rendering