Traditionally, Symfony services were configured in XML or YAML files. This creates a bit of a disconnect between your code and the configuration. In modern Symfony, we can use native PHP attributes to configure services. This allows us to keep our service configuration right in our code as native PHP metadata, which is pretty cool! Let's dive into these Dependency Injection attributes in the context of a fun example.
Google AI Professional Certificate - Learn AI Skills That Get You Hired
Power BI Fundamentals - Create visualizations and dashboards from scratch
Overview
Google, IBM & Meta Certificates — All 10,000+ Courses at 40% Off
One annual plan covers every course and certificate on Coursera. 40% off for a limited time.
Get Full Access
Syllabus
- Introduction
- Command Pattern with AutowireLocator
- Simplify with AutoconfigureTag and AsTaggedItem
- List Buttons with AutowireIterator
- Container and Iterator with ServiceCollectionInterface
- Alias an Interface with AsAlias
- Decorate a Service with AsDecorator
- Enforce Named Autowiring with Target
- Enable Services in Specific Environments with When
- Lazy Services
- More Laziness Attributes
Taught by
Kevin Bond