diff --git a/service_container/tags.rst b/service_container/tags.rst index c6cecfcd288..ffac1487a77 100644 --- a/service_container/tags.rst +++ b/service_container/tags.rst @@ -69,6 +69,8 @@ that it implements ``Twig_ExtensionInterface``) and adds the tag for you. interface, call the :method:`Symfony\\Component\\DependencyInjection\\ContainerBuilder::registerForAutoconfiguration` method in an :doc:`extension ` or from your kernel:: + .. code-block:: php + // app/AppKernel.php class AppKernel extends Kernel { @@ -82,6 +84,16 @@ that it implements ``Twig_ExtensionInterface``) and adds the tag for you. } } + If you do not want to create a custom kernel, it is also possible to use `_instanceof`: + + .. code-block:: yaml + + // app/config/services.yml + services: + _instanceof: + AppBundle\Component\CustomInterface: + tags: ['app.custom_tag'] + Creating custom Tags --------------------