egulias / tag-debug
Debug library for serivces tags registered in the Symfony 2 DIC
1.0.0
2014-08-27 21:10 UTC
Requires
Requires (Dev)
- phpunit/phpunit: ~4.0
- satooshi/php-coveralls: dev-master
This package is auto-updated.
Last update: 2024-12-16 03:44:08 UTC
README
This library will fetch information about all the tagged services
Installation and configuration
Get the lib
php composer.phar require egulias/tags-debug
Use
Basic usage
<?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
Filtering
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.