Working on a Codeigniter 2 Project right now I decided to give FirePHP a spin since it was pointed out to me for being somewhere around the next best thing to sliced bread for PHP Debugging… or something like that. It really seems nice so far I have to say!
Looking for some Codeigniter library but only finding a CI 1.7 one I decided to try to just drop in the provided code from the FirePHP site and guess what it just works. Download the FirePHPCore, currently 0.3.2,
and unpack FirePHP.class.php to the Codeigniter application/libraries folder (I also renamed it to firephp.php as well). Now the library can be loaded either via adding it to the autoload.php as
$autoload['libraries'] = array('firephp');
or just load it when needed via
$this->load->library('firephp');
I prefer to autoload since I only load it in my development autoload.php anyway. Having different configs for development and production is as easy as setting up a directory structure like the following and just drop the configs in the environment folders.
Now it is time to install both Firebug and the Firefox FirePHP Plugin for Firefox 8+. Currently the latest FirePHP needs to be installed via the link since the one provided as stable via Addons is not working with Firebug 1.9. Get the latest from the FirePHP site or you will get an error.
Thats it! Now logging a message is as easy as
$this->firephp->log("FirePHP is working!");