Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

SymfonyCasts

Dependency Injection #[Attributes]

via SymfonyCasts

Overview

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.

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

Reviews

Start your review of Dependency Injection #[Attributes]

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.