diff --git a/service_container/tags.rst b/service_container/tags.rst index 87f354434c2..c6ed02067e7 100644 --- a/service_container/tags.rst +++ b/service_container/tags.rst @@ -515,6 +515,45 @@ To answer this, change the service declaration: ; }; +.. tip:: + + In XML and YAML format, you may provide the tag an attribute called ``name``. + When doing so, this is the syntax you should follow: + + .. configuration-block:: + + .. code-block:: yaml + + # config/services.yaml + services: + MailerSmtpTransport: + arguments: ['%mailer_host%'] + tags: + - app.mail_transport: { name: 'arbitrary-value', alias: 'smtp' } + + .. code-block:: xml + + + + + + + + %mailer_host% + + app.mail_transport + + + + + .. versionadded:: 5.1 + + The possibility to add the ``name`` attribute to a tag in XML and YAML + formats was introduced in Symfony 5.1. + .. tip:: In YAML format, you may provide the tag as a simple string as long as