[] (https://travis-ci.org/egulias/TagDebugCommandBundle)
This bundle provides a simple command container:tag-debug
to allow to easily debug tagged services by
providing useful information about those defined in the app.
It will fetch information about all the tagged services.
You can apply filters and define your own filters
As for any command you should use: app/console
from your project root.
The command is:
$ php app/console container:tag-debug
--show-private
: if issued will show also private services.--filter
: can be many of this. The form is--filter name=param1,param2
for each filter, whereparam
are the parameters for the given filter.
- Name (
name
): Filter by tag name, exact match. Requires one parameter, e.g :--filter name=tag_name
- Attribute Name (
attribute_name
): Filter by tag attribute name, exact match. Requires one parameter, e.g :--filter attribute_name=attr_name
- Attribute Value (
attribute_value
): Filter by tag attribute value, exact match. Requires two parameters, e.g:--filter attribute_value=attr_name,attr_value
- NameRegEx (
name_regex
): Filter by tag name, giving a regular expression. No need to provide a separator (~
is used internally). Requires one parameter, e.g :--filter name_regex=regex
For more information see TagDebug lib
$ php app/console sf container:tag-debug --filter name=kernel.event_listener
See a sample output for this command
$ php app/console container:tag-debug
--filter name=kernel.event_listener
--filter attribute_value=event,kernel.controller
See a sample output for this command
Add to your composer.json
{
"require": {
"egulias/tag-debug-command-bundle": "~1.0"
}
}
Use composer to download the new requirement:
$ php composer.phar update egulias/tag-debug-command-bundle
<?php
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new Egulias\TagDebugCommandBundle\EguliasTagDebugCommandBundle(),
// ...
);
}
To create your custom filter follow this steps:
- Implement
Egulias\TagDebug\Tag\Filter
interface in your filter class. The filter will receive by constructor as many arguments as you define, from the console. See the examples above. Remember to add a constructor if you want to receive parameters. - On your config file add:
egulias_tag_debug_command:
filters:
- {class: Fully\Qualified\Filter\Class\Name, name:"filter_console_name"}
- Enjoy!