Skip to content

Document the hidden services and update debug:container docs #9775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions service_container.rst
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,9 @@ But, you can control this and pass in a different logger:
# explicitly configure the service
App\Service\MessageGenerator:
arguments:
# the '@' symbol is important: that's what tells the container
# you want to pass the *service* whose id is 'monolog.logger.request',
# and not just the *string* 'monolog.logger.request'
$logger: '@monolog.logger.request'

.. code-block:: xml
Expand Down Expand Up @@ -612,13 +615,7 @@ For a full list of *all* possible services in the container, run:

.. code-block:: terminal

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

.. tip::

The ``@`` symbol is important: that's what tells the container you want to pass
the *service* whose id is ``monolog.logger.request``, and not just the *string*
``monolog.logger.request``.
$ php bin/console debug:container

.. _services-binding:

Expand Down
11 changes: 8 additions & 3 deletions service_container/debug.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,22 @@ 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:
console. To show all services (public and private) and their PHP classes, run:

.. code-block:: terminal

$ php bin/console debug:container

By default, only public services are shown, but you can also view private services:
Hidden services, those whose ID starts with a dot character (``.``) aren't
included by default in the output of this command. Add the ``--show-hidden``
option to list them too:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need the paragraph? In other examples, we use inline comments which IMO would fit here well too:

.. code-block:: terminal

    $ php bin/console debug:container

    # use the --show-hidden option to display hidden services (services whose ID starts with a dot)
    $ php bin/console debug:container --show-hidden


.. code-block:: terminal

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

.. versionadded:: 4.1
Hidden services and the ``--show-hidden`` option were introduced in Symfony 4.1.

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

Expand Down