yii-debug-toolbar

A configurable set of panels that display various debug information about the current request/response.
124 followers

The Yii Debug Toolbar is a configurable set of panels that display various debug information about the current request/response and when clicked, display more details about the panel's content.

It is a ported to PHP famous Django Debug Toolbar.

Currently, the following panels have been written and are working:

  • Server info
  • Request timer
  • A list of superglobals
  • Application settings
  • SQL queries including time to execute and param bindings
  • Logging output via Yii built-in logging

Requirements

  • JavaScript enabled browser
  • Yii 1.1.4 +

Installation

Download sources from GitHub download page.

Extract the yii-debug-toolbar from archive under protected/extensions

Usage and Configuration

For use yii-debug-toolbar need to specify new route in log component:

'log'=>array(
        'class'=>'CLogRouter',
        'routes'=>array(
            array(
                'class'=>'ext.yii-debug-toolbar.YiiDebugToolbarRoute',
                'ipFilters'=>array('127.0.0.1','192.168.1.215'),
            ),
        ),
    ),
  • Make sure your IP is listed in the ipFilters setting. If you are working locally this option not required.
  • Enable Profiling and ParamLogging for all used DB connections.

Resources

Working preview

Screenshot 1

Screenshot 2

Change Log

November 28, 2011

* Added Views Rendering panel. It allows to view information about rendering process (view names, render methods, context objects and properties)
* Miscellaneous fixes

September 21, 2011

* Added SQL syntax highlighting
* Added highlighting of potentially inefficient queries 
* Miscellaneous fixes and UI enhancements

Juny 27, 2011

* Fixed PHP Error: `$_SESSION` variable is not defined

Juny 21, 2011

* Enhanced SQL log panel;
* Added new tab to SQL debug info with SQL servers info for all used connections;
* Added Yii debug status indicator to application settings panel;

Juny 20, 2011

* Initial release;

Total 20 comments

#8300 report it
sonnb at 2012/05/23 11:45pm
@Stratigos

The function itself already has condition to check jquery including status.

Yii::app()->getClientScript()->registerCoreScript('jquery');
#8296 report it
Stratigos at 2012/05/23 11:12am
Why always load jquery?

Hello,

Firstly id like to say this is a very nice tool, and I love having it in such a handy place while developing. Elegant display and very useful information presented.

Im wondering why class YiiDebugToolbar has to load jquery every time the widget is requested [see YiiDebugToolbar::registerClientScripts()]. Is it possible to have it check to see if jQuery is already loaded, and only call

Yii::app()->getClientScript()->registerCoreScript('jquery');

if jQuery is not found? The problem I am experiencing is with some partially rendered views (as popups) within some of the views in my app. As it subsequently loads jQuery for the view-within-a-view, my jQuery library stops functioning, and the resultant popup freezes. When I comment out this line within the YiiDebugToolbar class, everything works fine.

Is it possible to get this updated with the extension? If not I can extend this out myself.

Thanks!

#7506 report it
Mike Stop Continues at 2012/03/26 11:38pm
additionalPanels -- bug?

I have my config set like this:

array(
    'class'=>'ext.yii-debug-toolbar.YiiDebugToolbarRoute',
    'additionalPanels'=>array('ext.sample.YiiDebugToolbarPanelSample'),
),

YiiDebugToolbarRoute tries to call YiiDebugToolbar->appendPanel() ... but that doesn't exist. Are additionalPanels not supported? Or were appendPanel and prependPanel accidentally left out?

Thanks!

#7481 report it
skinner at 2012/03/25 02:39pm
> RE: Page load time vs Elapsed time

Elapsed time - This is the time elapsed from the time of receipt of the request to the server, see $_SERVER['REQUEST_TIME'] Page Load Time - This is the time elapsed from the time of start a application

#7473 report it
coke at 2012/03/24 01:14pm
Page load time vs Elapsed time

Here are some stats of "hello world" application from my Mac. No database connection.

  • Page Load Time: 0.07 s
  • Elapsed Time: 0.9 s

Why elapsed time is much higher than page load time? How are they defined? 0.9 sec is quite slow for a simple page like this. :)

#7366 report it
skinner at 2012/03/17 02:54pm
RE: How to use result window of this extension ?

What exactly you mean?

#7330 report it
onkar at 2012/03/14 10:39am
How to use result window of this extension ?

I am not getting any instruction to use this extension. Please help. thanks

#6893 report it
Fredi at 2012/02/11 07:21am
Great extension

The only feature i'm missing right now is ability to set levels in config.

#6748 report it
sventhegrinch at 2012/02/02 12:02pm
re: not displaying

OceanWind, that's correct, so if this is production you probably don't want that (at least not long term). Are you sure that the ip address that your production system sees when you go to it is the one you entered in ipTables? This sounds somewhat similar to my problem, where my external ip was different than my internal ip, and thus the plugin didn't recognize me when I cam in from my home system.

One very hacky way (which I used) to determine that was to add a Yii::log($ip, 'error'); to the allowIp function in YiiDebugToolbarRoute.php. Check the application log for the reported ip address and add it to the extensions ipFilters list. That showed me what my request came in on, and then I added that to the ipFilters variable. Maybe this helps...

#6747 report it
OceanWind at 2012/02/02 11:52am
re: not displaying

Thanks, Sven.

I was hoping to get a display on my production system, where the problem is occurring.

Won't setting 'ipFilters'=array('*') make the debugger display for everyone?

#6736 report it
sventhegrinch at 2012/02/02 12:03am
About not seeing the plugin...

Oceanwind, you may want to try setting ipFilters to:

'ipFilters'=>array('*')

At least temporarily. If that gets the plugin displayed, you can then try to figure out what ip address is seen by apache.

#6735 report it
OceanWind at 2012/02/01 11:41pm
Not displaying...

Is there anything else I need to do to get this to display? I've entered my IP into ipFilters, loaded the plugin into extensions, and set the DB connects to enable profiling and paramLogging. But nothing happens...

:-/

#6687 report it
coke at 2012/01/28 12:51pm
The best yii debugger extension

This debugger is way better than others I have seen in yii extension lib...

#6603 report it
lexand at 2012/01/20 09:05am
yii-debug-toolbar with Web Service

When I was trying to get WSDL from site with enabled yii-debug-toolbar, I was getting WSDL with HTML from yii-debug-toolbar.

Here is temporary solution YiiDebugToolbarRoute.php

protected function onBeginRequest(CEvent $event)
    {
        $route = Yii::app()->getUrlManager()->parseUrl(Yii::app()->request);
        $this->enabled = (preg_match('#^(?:services|test)/#',$route) == 0);
 
        $this->getToolbarWidget()
             ->init();
    }
#6563 report it
stratosgear at 2012/01/18 04:18pm
Workaround verified

Hello comment #6372 :)

You're right. I was trying to be politically correct and I was using Yii::app->end(). Ignoring it and just calling Php's exit() function does the trick.

To recap:

In order to correctly download a file (from inside a controller):

Yii::app()->request->sendFile("taxo.json",json_encode($dump, true),'text/plain', false);
exit();

Just don't use the $terminate option of the sendFile and rudely call exit() yourself after sending the file...

#6561 report it
demo88 at 2012/01/18 03:41pm
Disable with "exit"

Hey, I'm comment #6372:D

I found out that you obviously can disable the toolbar with the exit function. Yii::app()->end() does not work because it calls some "end-methods", so the toolbar.

Of course it only helps in specific situations, for example sending a file to the browser.

#6560 report it
stratosgear at 2012/01/18 03:34pm
Temporarily disable the output of debug info

Hello,

Really nice extension but I have a major problem (that has ALREADY been pointed to (in one way or another) THREE (3) different times (in comments #6372, #6248 and #5763) but still there is no resolution.

When I download a file with Yii::app()->request->sendFile(...)

The web debug html code is also injected in the downloaded file. Pretty much the same side effect as the Ajax request and webservices calls already mentioned.

How can I temporarily turn it off for specific controller actions...?

Thank you...

#6507 report it
sventhegrinch at 2012/01/15 05:02pm
Re: I don't see

Hey blacksheep,

I was also unable to see the toolbar. For me it turned out to be an issue with the extensions ipFilter. If you don't specify one, the extension will use:

'ipFilters'=>array('127.0.0.1','::1')

that's quite nice/reasonable, but in my case I had routing set up a little more complicated (going out to the ether and then coming back through my router). So I temporarily set it to:

'ipFilters'=>array('*')

which is not secure, but allowed me to see the toolbar. After taht I just had to identify what ip was actually being used. One very hacky way (which I used) was to add a Yii::log($ip, 'error'); to the allowIp function in YiiDebugToolbarRoute.php. Check the application log for the reported ip address and add it to the extensions ipFilters list. Hope this helps.

#6402 report it
blacksheep at 2012/01/07 11:51am
i don't see

how can i see the toolbar?? i follow the instruction, but how can i read into the toolbar? thanks!

#6372 report it
demo88 at 2012/01/04 08:06am
Disable

Is there a possibility to disable the toolbar for a specific action?

Leave a comment

Please to leave your comment.

Create extension