Setup ZFDebug for Debuging your Zend Framework Project

“ZFDebug is a plugin for the Zend Framework for PHP5, providing useful debug information displayed in a small bar at the bottom of every page.”


We just need two steps to setup ZFDebug:


1. Download it from, place it inside library just next to Zend Framework



2. Modify application/Bootstrap.php to add initialized function:


[codesyntax lang=”php” lines=”no” container=”div”]

 * include ZFDebug console in development environment
protected function _initZFDebug()
    // normally only section [development] has the "zfdebug" option
    if ($this->getOption('zfdebug')) {
        // namespace "ZFDebug" for autoloader
        $autoloader = Zend_Loader_Autoloader::getInstance();

        // initialize front controller
        $front = $this->getResource('FrontController');

        // enable zfdebug options
        $options = array('plugins' => array(

        // add caching backend option if specified
        if ($this->hasPluginResource('cache')) {
            $cache = $this->getPluginResource('cache')->getDbAdapter();
            $options['plugins']['Cache']['backend'] = $cache->getBackend();

        // add db option if specified
        if ($this->hasPluginResource('db')) {
            $db = $this->getPluginResource('db')->getDbAdapter();
            $options['plugins']['Database']['adapter'] = $db;

        // register ZFDebug with front controller
        $zfdebug = new ZFDebug_Controller_Plugin_Debug($options);



And that’s all, now you should see a debug bar just at the bottom of your project like this:


Posted in Zend Framework | Tagged , | Leave a comment