Cover of the book Symfony 5: The Fast Track

Symfony 5: The Fast Track is the best book to learn modern Symfony development, from zero to production. +300 pages in full color showing how to combine Symfony with Docker, APIs, queues & async tasks, Webpack, Single-Page Applications, etc.

Buy printed version
WARNING: You are browsing the documentation for Symfony 4.0 which is not maintained anymore. Consider upgrading your projects to Symfony 5.1.

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 and the class for each service, run:

1
$ php bin/console debug:container

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

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

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
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.