Get service via class name from iterable – injected tagged services

You no longer (since Symfony 4) need to create a compiler pass to configure a service locator. It’s possible to do everything through configuration and let Symfony perform the “magic”. You can make do with the following additions to your configuration: services: _instanceof: DriverInterface: tags: [‘app.driver’] lazy: true DriverConsumer: arguments: – !tagged_locator tag: ‘app.driver’ The … Read more