Mirage
Mirage

Reputation: 31548

What is need of using tags in symfony2 Services

I have read the symfony2 docs about tagged services

But i could not understand their example. Is there any other source or tutorial which can help me understanding why to use them

Upvotes: 1

Views: 62

Answers (1)

Elnur Abdurrakhimov
Elnur Abdurrakhimov

Reputation: 44841

From the Tags section of the Service Container chapter:

In the same way that a blog post on the Web might be tagged with things such as “Symfony” or “PHP”, services configured in your container can also be tagged. In the service container, a tag implies that the service is meant to be used for a specific purpose.

Basically, you tag a service for other services and/or components to know they can use it for their specific purposes.

Upvotes: 1

Related Questions