Warning: You are browsing the documentation for Symfony 2.4, which is no longer maintained.
Read the updated version of this page for Symfony 5.3 (the current stable version).
How to use Expressions in Security, Routing, Services, and Validation
How to use Expressions in Security, Routing, Services, and Validation¶
New in version 2.4: The expression functionality was introduced in Symfony 2.4.
In Symfony 2.4, a powerful ExpressionLanguage component was added to Symfony. This allows us to add highly customized logic inside configuration.
The Symfony Framework leverages expressions out of the box in the following ways:
- Configuring services;
- Route matching conditions;
- Checking security and access controls with allow_if;
For more information about how to create and work with expressions, see The Expression Syntax.
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.