Symfony Attributes Overview
Warning: You are browsing the documentation for Symfony 7.1, which is no longer maintained.
Read the updated version of this page for Symfony 7.2 (the current stable version).
Attributes are the successor of annotations since PHP 8. Attributes are native to the language and Symfony takes full advantage of them across the framework and its different components.
Dependency Injection
- AsAlias
- AsDecorator
- AsTaggedItem
- Autoconfigure
- AutoconfigureTag
- Autowire
- AutowireCallable
- AutowireDecorated
- AutowireIterator
- AutowireLocator
- AutowireMethodOf
- AutowireServiceClosure
- Exclude
- Lazy
- TaggedIterator
- TaggedLocator
- Target
- When
7.1
The TaggedIterator and TaggedLocator attributes were deprecated in Symfony 7.1.
Validator
Each validation constraint comes with a PHP attribute. See Validation Constraints Reference for a full list of validation constraints.