var_dump() in Firebug

In my previous post I talked about query profiling in Firebug with FirePHP. Today I will talk about another feature from the Zend Framework and FirePHP: logging.

Again, it’s very simple:

  • create a new Zend_Log
  • add the Zend_Log_Writer_Firebug to it
$log = new Zend_Log();
$log->addWriter(new Zend_Log_Writer_Firebug());
$log->debug($something);

This will behave like var_dump(), with these differences/improvements:

  • the output is displayed in Firebug
  • the HTML output doesn’t change
  • also for Ajax calls; no var_dump() info visible in the output from the Ajax call
  • the output has a nice layout

Remark: to use this, you need Firebug and FirePHP

Quick query checks with Firebug

Firebug gets better and better!
One of my last discoveries is Zend_Db_Profiler_Firebug. With this great feature of the Zend Framework it is possible to check queries in Firebug.
Step 1: install Firebug + FirePHP and activate the Console and Net tab
Step 2: activate Zend_Db_Profiler_Firebug in the application:

resources.db.params.profiler.class = Zend_Db_Profiler_Firebug
resources.db.params.profiler.enabled = true

For example enable it in development environment, and disable it in production.
Step 3: refresh your application, and see the queries appear in Firebug: you see the duration of all queries, and for each query individually, all parameters passed to the query and the total number of queries.

If you don’t want to use MySQL Proxy, this is a good alternative to check queries!

I have no hard data to prove it, but I don’t have the impression that it slows down my applications.
Does anybody know more about the performance of Profiler_Firebug?