use Symfony\Component\DependencyInjection\Definition; $definition = new Definition('MyClass'); $definition->addTag('my_tag');
use Symfony\Component\DependencyInjection\Definition; $definition = new Definition('MyClass'); $definition->addTag('my_tag', ['attribute_name' => 'attribute_value']);This will add the tag "my_tag" to the service definition "MyClass" with an attribute "attribute_name" having a value of "attribute_value". The package library for this method is "symfony/dependency-injection".