egulias / tag-debug-command-bundle
Symfony 2 console command to debug services tags
Installs: 17
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 2
Forks: 1
Open Issues: 0
Type:symfony-bundle
Requires
- egulias/tag-debug: ~1.0
- symfony/console: ~2.3
- symfony/dependency-injection: ~2.3
- symfony/framework-bundle: ~2.3
- symfony/http-kernel: ~2.3
Requires (Dev)
- matthiasnoback/symfony-config-test: 0.*
- phpunit/phpunit: >=3.7
- satooshi/php-coveralls: dev-master
This package is auto-updated.
Last update: 2024-11-16 03:42:20 UTC
README
[] (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
Usage
As for any command you should use: app/console
from your project root.
The command is:
$ php app/console container:tag-debug
Available options
--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.
Available filters
- 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
Sample usage and output
Sample Filter
$ php app/console sf container:tag-debug --filter name=kernel.event_listener
See a sample output for this command
Two filters, one with multiple values
$ php app/console container:tag-debug --filter name=kernel.event_listener --filter attribute_value=event,kernel.controller
See a sample output for this command
Installation and configuration
Get the bundle
Add to your composer.json
Symfony >= 2.3
{ "require": { "egulias/tag-debug-command-bundle": "~1.0" } }
Use composer to download the new requirement:
$ php composer.phar update egulias/tag-debug-command-bundle
Add TagDebugCommandBundle to your application kernel
<?php // app/AppKernel.php public function registerBundles() { return array( // ... new Egulias\TagDebugCommandBundle\EguliasTagDebugCommandBundle(), // ... ); }
Configure your own filters
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!