Introducing Fire Profiler

Difficulty: Medium

Anyone using Firefox and developing stuff for the web should know about Firebug. It’s an excellent tool for web development helping you with ajax, js, css, and what not. Today I read about FirePHP on Webmonkey. FirePHP is a plugin for Firebug and can help you with PHP debugging. I never paid much attention to it though, till today.

Anyway, today I did start using FirePHP and it’s quite neat. I had some spare time and worked Kohana’s profiler into FireProfiler. Despite the crappy name, it works well. It is the same as the normal profiler in Kohana, only the output is sent to FireBug where it’s formatted nicely and shown to you in a table. You can also use FirePHP’s other features.

Before using this profiler you first need to install Firebug and FirePHP. You install Fire Profiler by moving the Fire_Profiler file to your ‘libraries’ directory. Also, download the PHP library from the FirePHP site, move the FirePHP.class.php from the archive to your ‘libraries’ directory and rename it from FirePHP.class.php to FirePHP.php. Now you’re done.

First the Fire Profiler functionality. Do the following in the file you want to profile:

$firephp=new Fire_Profiler;

That’s it, you’ll see something like this in your FireBug console Nice :)

Of course the normal FireBug behaviour is preserved:

$firephp=new Fire_Profiler;
$firephp->dump($_SERVER, 'Server Variables');
$firephp->log($_SESSION, '$_SESSION',FirePHP::LOG);
$firephp->fb('Info message' ,FirePHP::INFO);
$firephp->fb('Warn message' ,FirePHP::WARN);
$firephp->fb('Error message',FirePHP::ERROR);

Will render:

I hope some might find it useful. Don’t forget to remove the profiler when in production since everyone with FirePHP will see the stuff.


3 Responses to “Introducing Fire Profiler”

  1. Zoxive Says:

    Thanks for posting this, it looks very useful, and I am in the process of trying it out right now.

  2. Matt Says:

    Nice find Dlib! Thanks

  3. bennythemink Says:

    Thanks dlib! its very handy. nice post.

Leave a Comment