Introduction
Since Symfony 4.2, services can now be bound by type and name.
Syntax
# config/services.yaml
services:
_defaults:
bind:
# it works with scalar types too (string, int, array, etc.)
string $adminEmail: '[email protected]'
# but it's mostly used with classes
Psr\Log\LoggerInterface $requestLogger: '@monolog.logger.request'