This library will fetch information about all the tagged services
php composer.phar require egulias/tags-debug
<?php
use Egulias\TagDebug\Tag\TagFetcher;
use Egulias\TagDebug\Tag\FilterList;
use Symfony\Component\DependencyInjection\ContainerBuilder;
$containerBuilder = new ContainerBuilder;
$fetcher = new TagFetcher($containerBuilder);
$filters = new FilterList();
$tags = $fetcher->fetch($filters);
$tags
will have one key for each tag name:
$tags['tag-name']['Class\Name\Of\Service']['tag'] = Egulias\TagDebug\Tag\Tag
$tags['tag-name']['Class\Name\Of\Service']['definition'] = Symfony\Component\DependencyInjection\Definition
Currently filters work in an "AND" fashion, which means that the Tag must comply every filter.
<?php
use Egulias\TagDebug\Tag\TagFetcher;
use Egulias\TagDebug\Tag\FilterList;
use Egulias\TagDebug\Tag\Filter\Name;
use Symfony\Component\DependencyInjection\ContainerBuilder;
$containerBuilder = new ContainerBuilder;
$fetcher = new TagFetcher($containerBuilder);
$filters = new FilterList();
$filters->addFilter(new Name("nameToFilterFor"));
$tags = $fetcher->fetch($filters);
You can implement your own filters by implementing Egulias\TagDebug\Tag\Filter
and then adding it to the filter list.