This bundle provides a simple command container:debug:listeners
to allow to easily debug listeners by
providing useful information about those defined in the app. It will fetch information about all the listeners
tagged with .event_listener
If you are using this from Symfony <= 2.2, please update your composer.json file to use version=1.4.1 which is the current stable branch for Symfony 2.2.x
If you are using this from Symfony 2.0.x, please update your deps file to use version=symfony2.0.x which is the current stable branch for Symfony 2.0.x
As for any command you should use: app/console
from your project root.
The command is:
app/console container:debug:listeners
There are 4 available options:
- --show-private : if issued will show also private services
- --event=event.name: if issued will filter to show only the listeners listening to the given name (ordered by descending priority)
- --order-asc: in combination with --event orders them by ascending priority
- --listeners: if issued will filter to show only the listeners (only available since Symfony 2.1.x)
- --subscribers: if issued will filter to show only the subscribers (only available since Symfony 2.1.x)
- Output for
container:debug:listeners
Here - Output for
container:debug:listeners --event=kernel.response
Here - Output for
container:debug:listeners listener.id
Here - Output for
container:debug:listeners --listeners
Here - Output for
container:debug:listeners --subscribers
Here
- Output for
container:debug:listeners
Here - Output for
container:debug:listeners --event=kernel.response
Here - Output for
container:debug:listeners listener.id
Here - Output for
container:debug:listeners --listeners
Here - Output for
container:debug:listeners --subscribers
Here
- Output for
container:debug:listeners
Here - Output for
container:debug:listeners --event=kernel.request
Here - Output for
container:debug:listeners listener.id
Here
Add to your composer.json
##Symfony >= 2.3
{
"require": {
"egulias/listeners-debug-command-bundle": "1.9.0"
}
}
##Symfony >= 2.2
{
"require": {
"egulias/listeners-debug-command-bundle": "symfony2.2"
}
}
Use composer to download the new requirement
$ php composer.phar update egulias/listeners-debug-command-bundle
<?php
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new Egulias\ListenersDebugCommandBundle\EguliasListenersDebugCommandBundle(),
// ...
);
}
##Symfony 2.0.x
Add to your /deps
file :
[EguliasListenersDebugCommandBundle]
git=git@github.com:egulias/ListenersDebugCommandBundle.git
target=/bundles/Egulias/ListenersDebugCommandBundle
version=symfony2.0.x
And make a php bin/vendors install
.
<?php
// app/autoload.php
$loader->registerNamespaces(array(
'Egulias' => __DIR__.'/../vendor/bundles',
// your other namespaces
));
<?php
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new Egulias\ListenersDebugCommandBundle\EguliasListenersDebugCommandBundle(),
// ...
);
}