Developed with love by KnpLabs Hire us for your project!
81

ListenersDebugCommandBundle

by egulias

A Symfony 2 console command to debug listeners

Listeners debug Command for Symfony2 console Build Status Coverage Status SensioLabsInsight

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

IMPORTANT

Symfony 2.2.X

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

Symfony 2.0.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

Usage

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

Available options

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)

Sample output (Symfony >= 2.3)

  • 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

Sample output (Symfony >= 2.1.x <= 2.2.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

Sample output (Symfony 2.0.x)

  • Output for container:debug:listeners Here
  • Output for container:debug:listeners --event=kernel.request Here
  • Output for container:debug:listeners listener.id Here

Installation and configuration

Get the bundle

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

Add ListenersDebugCommandBundle to your application kernel

<?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.

Register the namespace

<?php

  // app/autoload.php
  $loader->registerNamespaces(array(
      'Egulias' => __DIR__.'/../vendor/bundles',
      // your other namespaces
      ));

Add ListenersDebugCommandBundle to your application kernel

<?php

  // app/AppKernel.php
  public function registerBundles()
  {
    return array(
      // ...
      new Egulias\ListenersDebugCommandBundle\EguliasListenersDebugCommandBundle(),
      // ...
      );
  }
Copyright (c) 2012 Eduardo Gulias

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
  • Merge pull request #27 from jrobeson/patch-1
    By egulias, 2 years ago
  • install composer from install key in .travis.yml
    By jrobeson, 2 years ago
  • #24 - Change command name
    By egulias, 2 years ago
  • Update repository requirements and some CS fixes from #26
    By egulias, 2 years ago
  • #25 - Improved tests and subscriber definition
    By egulias, 2 years ago
  • #25 - Removed unnesary components from the container xml. Removed tests from being part of the coverage
    By egulias, 2 years ago
  • Allow phpunit >=3.7 as dependency
    By mmoreram, 2 years ago
  • Normalized php files
    By mmoreram, 2 years ago
  • Added specific symfony packages requirements
    By mmoreram, 2 years ago
  • Allowing failure for hhvm
    By egulias, 2 years ago
  • Tests for the command, usage of ListenersDebug library, brancha alias and new version
    By egulias, 2 years ago
  • Improve legibility of the ordering option
    By egulias, 2 years ago
  • SensioLabs badge
    By egulias, 2 years ago
  • Unused statements and permissions
    By egulias, 2 years ago
  • Merge pull request #21 from h4cc/patch-1
    By egulias, 2 years ago
  • Update .travis.yml
    By h4cc, 2 years ago
  • Version number in the example
    By egulias, 3 years ago
  • Badge update
    By egulias, 3 years ago
  • Coveralls config
    By egulias, 3 years ago
  • Using satoshi lib
    By egulias, 3 years ago
  • Using coverall.io with travis-ci
    By egulias, 3 years ago
  • Merge pull request #19 from egulias/refactor
    By egulias, 3 years ago
  • #14 - Bug on signature change
    By egulias, 3 years ago
  • #14 - Build status
    By egulias, 3 years ago
  • #14 - Travis :)
    By egulias, 3 years ago
  • #14 - Listener command option refactored
    By egulias, 3 years ago
  • #14 - Split and tests. Fetcher without filters
    By egulias, 3 years ago
  • #14 - Removing responsabilities from the command to Filter
    By egulias, 3 years ago
  • Merge pull request #18 from digitalkaoz/patch-1
    By egulias, 3 years ago
  • fixed some bugs
    By digitalkaoz, 3 years ago