Introducing Fire Profiler
- Posted by dlib on July 21st, 2008 filed in Code examples, 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);
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.
July 22nd, 2008 at 1:32 am
Thanks for posting this, it looks very useful, and I am in the process of trying it out right now.
July 22nd, 2008 at 10:06 am
Nice find Dlib! Thanks
July 22nd, 2008 at 10:49 am
Thanks dlib! its very handy. nice post.