You can pass the container parameters to your service using the notation %your_param_name% :
services: kernel.listener.locale_listener: class: My\BundleName\Listener\LocaleListener tags: - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest } arguments: [ @router, @service_container, %your_param_name% ]
which will present as an example (in this example) the third argument in the service constructor method:
public function __construct($router, $container, $paramValue) {
richsage
source share