Skip to content

How to Debug the Service Container & List Services

Warning: You are browsing the documentation for Symfony 6.3, which is no longer maintained.

Read the updated version of this page for Symfony 7.1 (the current stable version).

You can find out what services are registered with the container using the console. To show all services (public and private) and their PHP classes, run:

1
2
3
4
$ php bin/console debug:container

# add this option to display "hidden services" too (those whose ID starts with a dot)
$ php bin/console debug:container --show-hidden

To see a list of all of the available types that can be used for autowiring, run:

1
$ php bin/console debug:autowiring

Debugging Service Tags

Run the following command to find out what services are tagged with a specific tag:

1
$ php bin/console debug:container --tag=kernel.event_listener

Partial search is also available:

1
2
3
4
5
6
7
8
9
10
$ php bin/console debug:container --tag=kernel

Select one of the following tags to display its information:
 [0] kernel.event_listener
 [1] kernel.event_subscriber
 [2] kernel.reset
 [3] kernel.cache_warmer
 [4] kernel.locale_aware
 [5] kernel.fragment_renderer
 [6] kernel.cache_clearer

6.2

The partial search was introduced in Symfony 6.2.

Detailed Info about a Single Service

You can get more detailed information about a particular service by specifying its id:

1
2
3
4
$ php bin/console debug:container App\Service\Mailer

# to show the service arguments:
$ php bin/console debug:container App\Service\Mailer --show-arguments
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.
TOC
    Version