MadaConsole – A debug console for Zend Framework
Update: See my guide on How to make your own Zend Framework Resource Plugin
Building Facebook applications with Zend Framework, I've needed a debug console that can shows messages even in a Facebook canvas page, through an ajax request or a redirect.
For this purpose I've build a custom plugin for ZF that fits the need: it will sit under your pages and shows all your dumped object, messages and queries.
Usage is really simple: copy in your library and add the plugin in your Boostrap or application.ini.
For a detailed guide see below.
Features
- Trace custom messages easily:
debug("A debug message"); - Dump variables easily in your code with the pass-through function:
Before:array_count_values($arr);After:array_count_values(debug($arr)); - Shows the queries executed by your Zend_Table
- Shows debug messages even through redirects or ajax requests
Install
Installing the plugin is simple:
- Download the archive: MadaConsole
- Unzip the library folder of the archive in the library folder of your Zend Framework application
Then you can configure it with two methods: through your application.ini or in the Bootsrap class.
Method1: application.ini
Add those lines after [development : production]:
pluginPaths.MadaConsole = "MadaConsole"
resources.console = true
Method 2: Bootstrap class
Add this method:
Usage
Now in your code you can do:
-
debug("A debug message");
-
debug($myArray);
-
-
$data = debug($myModel->findAll());
-
//It will recognize Zend_Db_* objects
With the pass-through functionality you can simply add the debug() function in your existing statements with ease: $var = debug(my_func($foo));
To see the debug output when you do an ajax request, you can open a page of your choice in another browser window: the debug console will show all the messages site-wide.
Downloads
MadaConsole plugin
MadaConsole example Zend Framework project


[...] desses novos recursos na minha aplicação vários erros surgirão, então descobri um plugin bacana e fácil de instalar e utilizar, que exibe erros, sql, dump de variaveis ou array de uma forma [...]
Pingback by Os primeiros passos com Zend Framework « Diorgenes Felipe Grzesiuk — August 20, 2009 @ 7:15 pm