How to Debug the Service Container & List Services

Version: 3.4
Edit this page

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

Read the updated version of this page for Symfony 5.3 (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:

$ php bin/console debug:container

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

$ php bin/console debug:container --show-private

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

$ php bin/console debug:autowiring

New in version 3.4

The debug:autowiring command was introduced in Symfony 3.3.

Detailed Info about a Single Service

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

$ php bin/console debug:container 'AppBundle\Service\Mailer'

# to show the service arguments:
$ php bin/console debug:container 'AppBundle\Service\Mailer' --show-arguments

New in version 3.3

The --show-arguments option was introduced in Symfony 3.3.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.