New Getter injection in Symfony 3.3


Getter injection is one of the new experimental features in Symfony 3.3. It adds up to the usual mechanisms used for dependency injection and doesn’t replace any of them. Instead, it provides an additional way that fits some specific use cases.

Getter injection allows the dependency injection container to leverage classes that provide inheritance-based extension points that matches the following requirements: public or protected methods with zero arguments and free of side-effects.

Nicolas Grekas have written an introductory blog to the new getter injection feature providing examples, pros and cons of the new features. Most notable is that this new feature is targeted at being used for framework-specific needs first. The target for now is to provide decoupled composable base controller trait(s).


Please enter your comment!
Please enter your name here