SymfonyWorld 2022 Summer Edition
100% Online
+20 talks and workshops
Starts in 20 days

How to Debug the Service Container & List Services

Edit this page

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

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

How to Debug the Service Container & List Services

You can find out what services are registered with the container using the console. To show all services and the class for each service, run:

1
$ php app/console debug:container

2.6

Prior to Symfony 2.6, this command was called container:debug.

By default, only public services are shown, but you can also view private services:

1
$ php app/console debug:container --show-private

Note

If a private service is only used as an argument to just one other service, it won't be displayed by the debug:container command, even when using the --show-private option. See Inline Private Services for more details.

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

1
$ php app/console debug:container app.mailer
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.