Original message

Let me introduce my first symfony plugin : sfFirePHPLoggerPlugin. Working with symfony and Firebug would have never been so easy ! It allows you to display in a clean, readable and structured way anything you want from your PHP code, and even the symfony built-in events through a sfLogger class.

Requirement

Firefox : You'll need a version > 2 and up Firebug : Install the version 1.1 if you run Firefox 2+, or the version 1.2 if you run Firefox 3+ and up FirePHP : Download the FirePHP extension for Firefox

Getting started

Extract the plugin in your project plugin's directory, as for any symfony plugin.

Then merge the following lines to your application factories.yml file (located in path/to/your/project/apps/myApps/config/factories.yml) :

dev:
  logger:
    class: sfAggregateLogger
    param:
      level: debug
      loggers:
        sf_FirePHP:
          class: sfFirePHPLogger
          param:
            level: debug

Clear your project cache :

$ path/to/your/project/symfony cc

And you're done, you should have now something like :

sfFirePHPLoggerPlugin_screenshot.png

Logging more than messages

You can of course access the FirePHP class like any other class in symfony. So all the examples on firephp.org would work in the same way :)

You can now log and display in a neat way your arrays, your objects and much more !


FirePHP::getInstance(true)->dump($myObject);
FirePHP::getInstance(true)->dump(array('key' => 'value', 'anotherkey' => 'anothervalue');

Security

As firePHP can display sensible data about the inner mechanisms of your website, I strongly advise you to never use it in an other environment than development.

Download

   * sfFirePHPLoggerPlugin-0.2.zipsfFirePHPLoggerPlugin-0.2.zip
   * sfFirePHPLoggerPlugin-0.2.tar.gzsfFirePHPLoggerPlugin-0.2.tar.gz

Links

   * more about how to log your message in symfony
   * the FirePHP official documentation
   * the FireBug Documentation

Feedback

Feel free to comment here with your opinion and your remarks.