Skip to content

Recommend using the FQCN as a service ID #9886

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 1 commit into from
Closed
Changes from all 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
10 changes: 7 additions & 3 deletions bundles/best_practices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -381,13 +381,17 @@ Bundles must be versioned following the `Semantic Versioning Standard`_.
Services
--------

If the bundle defines services, they must be prefixed with the bundle alias.
For example, AcmeBlogBundle services must be prefixed with ``acme_blog``.
If the bundle defines services, they should use the FQCN of the
underlying class as an ID. If they cannot, or if the class is defined in
another vendor, they must be prefixed with the bundle alias.

For example, AcmeBlogBundle services created from classes defined in the
``AnotherVendor`` namespace must be prefixed with ``acme_blog``.

In addition, services not meant to be used by the application directly, should
be :ref:`defined as private <container-private-services>`. For public services,
:ref:`aliases should be created <service-autowiring-alias>` from the interface/class
to the service id. For example, in MonologBundle, an alias is created from
to the service id when applicable. For example, in MonologBundle, an alias is created from
``Psr\Log\LoggerInterface`` to ``logger`` so that the ``LoggerInterface`` type-hint
can be used for autowiring.

Expand Down