ZFDebug panel quick tutorial

In this post I’ll just write some notes to install the ZFDebug panel for Zend Framework. That’s basically a front controller plugin that displays at the bottom of the layout (slides from the bottom), contains “debug panels” (cache, variables, zend db, time info etc…) and it’s easy to extend.

Copy libraries and images

Grab the last stable zip from the Downloads page, or just export the SVN (just my preference as it’s a debug panel, unstable features are OK).

#install library
cd <zendProjectRoot>/library
svn export http://zfdebug.googlecode.com/svn/trunk/library/ZFDebug/
# [not necessary] copy images (if images dir already exists, go inside and export a level less)
cd <zendProjectRoot>/public
svn export http://zfdebug.googlecode.com/svn/trunk/web/images/

Activate using a boostrap _init() method
Now, the plugin can be activated using a Bootstrap _init method (some options cna be moved to application.ini, but some others don’t, so better to keep everything together in a _init method IMO).

copy the whole method from here
to your Boostrap. To add plugins, read the comments inside that file. Better to create plugin classes to make easy updating ZFDebug from SVN.

The minimum code to load should be the following (not tested). Of course add the logic to show only on local environment or under some conditions (auth / cookie / env)

protected function _initZFDebug()
    // register namespace
    $autoloader = Zend_Loader_Autoloader::getInstance()

    // Create ZFDebug instance
    $zfdebug = new ZFDebug_Controller_Plugin_Debug(array(
        'plugins' => array(
            #'Database' => array('adapter' => array('standard' => Zend_Db_Table_Abstract::getDefaultAdapter())),
            #'File' => array('basePath' => 'path/to/application/root'),
            #'Cache' => array('backend' => Zend_Registry::get('cache')->getBackend()),

    // Register ZFDebug with the front controller
    $front = $this->getResource('FrontController');

BSD licence