How to Debug the Service Container & List Services

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 (public and private) and their PHP classes, run:

  1. $ php bin/console debug:container
  2. # add this option to display "hidden services" too (those whose ID starts with a dot)
  3. $ 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

Detailed Info about a Single Service

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

  1. $ php bin/console debug:container 'App\Service\Mailer'
  2. # to show the service arguments:
  3. $ 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.