Skip to content

Commit

Permalink
Merge 34e8a8a into 597f9c5
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Aug 28, 2014
2 parents 597f9c5 + 34e8a8a commit 492e26d
Showing 1 changed file with 41 additions and 25 deletions.
66 changes: 41 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Tag debug Command for Symfony2 console [![Build Status](https://travis-ci.org/egulias/TagDebugCommandBundle.png?branch=master)] (https://travis-ci.org/egulias/TagDebugCommandBundle) [![Coverage Status](https://coveralls.io/repos/egulias/TagDebugCommandBundle/badge.png?branch=master)](https://coveralls.io/r/egulias/TagDebugCommandBundle?branch=master)[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/egulias/TagDebugCommandBundle/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/egulias/TagDebugCommandBundle/?branch=master)
# Tag debug Command for Symfony2 console

[![Build Status](https://travis-ci.org/egulias/TagDebugCommandBundle.png?branch=master)] (https://travis-ci.org/egulias/TagDebugCommandBundle) [![Coverage Status](https://coveralls.io/repos/egulias/TagDebugCommandBundle/badge.png?branch=master)](https://coveralls.io/r/egulias/TagDebugCommandBundle?branch=master)[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/egulias/TagDebugCommandBundle/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/egulias/TagDebugCommandBundle/?branch=master)

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.
Expand All @@ -10,48 +12,64 @@ You can apply [filters](#available-filters) and define [your own filters](#confi

As for any command you should use: `app/console` from your project root.
The command is:
`app/console container:tag-debug`

```bash
$ 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,
where `param` are the parameters for the given filter
* `--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, where `param` 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). Requiers one parameter, e.g : --filter name_regex=regex

* 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](https://github.com/egulias/TagDebug)

###Sample usage and output
Sampel Filter
-----
`app/console sf container:tag-debug --filter name=kernel.event_listener` [Here](https://gist.github.com/egulias/143a3c458190f206f730)
### Sample usage and output

#### Sample Filter

Two filters, one with multiple values
-----
`app/console container:tag-debug --filter name=kernel.event_listener --filter attribute_value=event,kernel.controller` [Here](https://gist.github.com/egulias/4341f7dfc3206cca5ef8)
```bash
$ php app/console sf container:tag-debug --filter name=kernel.event_listener
````

[See a sample output for this command](https://gist.github.com/egulias/143a3c458190f206f730)

#### Two filters, one with multiple values

```bash
$ php app/console container:tag-debug
--filter name=kernel.event_listener
--filter attribute_value=event,kernel.controller
```

[See a sample output for this command](https://gist.github.com/egulias/4341f7dfc3206cca5ef8)

# Installation and configuration

## Get the bundle
Add to your composer.json

##Symfony >= 2.3
Add to your `composer.json`

```
## Symfony >= 2.3

```json
{
"require": {
"egulias/tag-debug-command-bundle": "~1.0"
}
}
```

Use composer to download the new requirement
```
Use composer to download the new requirement:

```bash
$ php composer.phar update egulias/tag-debug-command-bundle
```

Expand All @@ -72,7 +90,8 @@ $ php composer.phar update egulias/tag-debug-command-bundle
```

## Configure your own filters
To create your custom filter follow this steps

To create your custom filter follow this steps:

1. 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.
Expand All @@ -84,6 +103,3 @@ egulias_tag_debug_command:
- {class: Fully\Qualified\Filter\Class\Name, name:"filter_console_name"}
```
3. Enjoy!



0 comments on commit 492e26d

Please sign in to comment.