This extension is very useful in the development stage of project. It helps you to get info about PHP environment, application, queries logs, benchmarking with a simple little toolbar at the top of the page.
It is a recreated Symfony's developer toolbar. First idea and very first implementation was my, but this version mostly implemented by Eduard Kuleshov.
This version tested for 1.0.x branch of Yii Framework.
Last update gives additional security option. If you worry about this please download last version. (Check the README file for details)
Working for 1.1.x branch and PHP 5.3 also is good.
Resources ¶
NOTE: Project Home Page changed from Google Code to the GitHub.com
Documentation ¶
Requirements ¶
- Yii 1.0 or above
Installation ¶
- Extract the release file under
protected/extensions
Usage ¶
main.php configuration file update:
[...]
// autoloading model and component classes
'import'=>array(
'application.models.*',
'application.components.*',
'application.extensions.yiidebugtb.*', //our extension
),
[...]
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'error, warning, trace',
),
array( // configuration for the toolbar
'class'=>'XWebDebugRouter',
'config'=>'alignLeft, opaque, runInDebug, fixedPos, collapsed, yamlStyle',
'levels'=>'error, warning, trace, profile, info',
'allowedIPs'=>array('127.0.0.1','::1','192.168.1.54','192\.168\.1[0-5]\.[0-9]{3}'),
),
),
),
[...]
Options are:
- 'alignLeft' => Debug toolbar will be aligned to the top left corner of browser window
- 'opaque' => Makes debug toolbar almost invisible when it's minimized
- 'runInDebug' => Show debug toolbar only if Yii application running in DEBUG MODE (see index.php for details)
- 'fixedPos' => Makes debug toolbar sticky with browser window, not document!
- 'collapsed' => Show debug toolbar minimized by default.
- 'yamlStyle' => Show configuration report in Yaml or PHP-array style.
Also there is an additional security feature you may need - 'allowedIPs' option. This option holds the array of IP addresses of all machines you need to use in development cycle. So if you forget to remove YII_DEBUG from bootstrap file for the production stage, your client don't see the toolbar anyway. By default (if you didn't define it) there is only one IP address in allowedIPs list - 127.0.0.1.
Now you can use regexp patterns in allowedIPs options section to describe which hosts able to view YiiDebugToolbar in a more flexible way. Here is the example which allow to show YiiDebugToolbar to whole bunch of computers in 192.168.10-15.* subnet: '192.168.1[0-5].[0-9]{3}'.
Change Log ¶
January 25, 2011 ¶
- Fixed 'pxt' in styles section of view file
- Improved allowedIPs option section to use regexp pattern matching (thanks to canni - https://github.com/canni)
September 23, 2010 ¶
- Fixed showing of traceback messages
August 18, 2010 ¶
- Added 'allowedIPs' option to configuration file
March 18, 2010 ¶
- Added 'return' to 'onclick' handlers (http://github.com/cr0t/yiidebugtb/issues/closed#issue/2)
March 15, 2010 ¶
- Fixed fonts, colors and links styles (http://github.com/cr0t/yiidebugtb/issues/closed#issue/1)
February 25, 2010 ¶
- Fixed minor bug with 'Post' and 'Get' arrays of request parameters
January 26, 2010 ¶
- Fixed horizontal scroll, removed borders from yiidebugpanel, also fixed fonts for yiidebugpanel
January 22, 2010 ¶
- Changed project home page from Google Code to Github.com
January 11, 2010 ¶
- Updates and fixes for properly work for 1.1.x branch and PHP 5.3.
January 11, 2010 ¶
- Initial release.
Re: Disable for some actions
Hello Sergey,
You are absolutely right, I was testing usng browser GET requests and saw the toolbar code.
But after I wrote yesterday post I tested with ajax requests also and saw that the toolbar code wasn't included. Extremely neat! :)
Thank you for this great tool!
Re: Disable for some actions
Hello,
For the XHR (AJAX) requests we do not send the Yii Debug Toolbar output.
But I think you are trying to debug AJAX output using simple GET requests from your browser? If so, I would like to recommend you to use special extensions for such debugging, like Firebug extension for Firefox, or developer tools (which are included by default) in the Safari or Chrome browsers.
Best regards,
Sergey Kuznetsov.
Disable for some actions
Hi,
How can I disable the extension for a bunch of actions that spit an ajax response? I would like my ajax actions to not inclide the debug toolbar code because it messes up my application.
Thanks!
Should be in Yii/Zii
Fantastic.
This should definitely be included with Yii as part of the distribution - maybe in Zii as an official extension.
Re: damaged archive
I successfully download archive and unpacked it.
Please, try again. If you will get an error, you could try to download it from the homepage: http://cr0t.github.com/yiidebugtb/
Its's a great tools
Thank you !
To display correctly dumps with
print_r()
, I simply addedpre
tags inyiiDebugClass
, line 204 :and some CSS in debugPanel.php :
#yiiWebDebugPanel pre { line-height:1em; margin: 0; }
Grate extension
This extension is awesome :). I think it should be part of Yii out of the box in the future.
Awesome
I just want to say that this extension is awesome!
thanks
thanks
I was stuck and yiidebugtb helped me out of it !
Thanks again for this extension . Just a remark.
After installing it , my the feed extension based on zend didn't mouth the messages anymore. I first thought that was me but as soon as I disconnected yiidebugtb, It worked again.
So be aware of possible side effects. However, they are microscopically tiny compared to the huge benefits of using yiidebugtb.
I love it !
Excellent
Wow, I do not know how I got along without it.
This is a great tool
It has already saved me untold hours tracking down a nasty issue with sqlite. It is working perfect for me wit 1.1.
modules
very usefull!
working 100% under modules.
Perfect!
I also changed from symfony to yii and this debug toolbar really is what I missed. Thank you!
Great extension
I just want to tell you - thank you. I was coming from Symfony and I was really missing the Web Debug toolbar.
Download from another place
To "waipy": If you have troubles with downloading file you may write message to the forum, not to the reviews.
Also, you could try download this extension from another place, here - http://code.google.com/p/yiidebugtb/downloads/list.
Or you can use svn access to retrieve sources from SVN repository using this command:
svn checkout http://yiidebugtb.googlecode.com/svn/trunk/ yiidebugtb-read-only
the file is damaged!
the file is damaged!
I can't open the file
Love It!
So much nicer way to get the info than to have it appended to the bottom of the page! Thank you!
Great Extension!
Thanks a lot!
Very Cool!
Could be a little bit more stylish which is
reasonable since it's a very early release .
Other than that , great !!
Confirmed working on Yii 1.1.0
Be careful not to use it for public projects
Be careful not to use it for public projects since application config is displayed including db username and password.
Otherwise, great extension.
Great!!!!
Thats a great extension. Thanks.
I used it with 1.1, No problems yet
Awesome
tahnks, good job !
What should I be seeing?
I don't seem to see the debug panel. I have no errors and have followed all of the steps.
Cheers
query time
Hi,
I think it will be very usefull to have each query executio time shown somwhere near sql query.
thanks :)
Fork
Here is a fork with ability to turn off yiidebugtb output in any controller action.
https://github.com/zadoev/yiidebugtb
Great
This is a great extension!
great extension
Thank you for this very useful extension...
Every project that I begin to work on, starts by adding this extension
Vote up!
Excellent extension! Thanks for sharing!
Usefull
Great extension, very very useful.
Another great extension
Thanks for sharing, this extension is great !
Kudos!
Very handy! Keep up the good work!
this sounds so good
i'm gonna try this tomorrow morning for sure.
sounds like a great extension
just love it
you must be a fool to vote against this one.
LOVE IT!
Its my most favorite extension. If you like it, here is a potential discussion that might lead to its inclusion in Yii as core feature. Take some time to star it:
http://code.google.com/p/yii/issues/detail?id=2351
invalid HTML code
The only thing that I do not like about this extension is that it produces invalid (X)HTML code. (It simply appends <style>, <script>, etc. at places where they must not be, uses "(" in an id attribute, uses <center>, etc.) Maybe I can be bothered to fix all this at some point, but until then it screws up my HTML validator which keeps me from using it, as I cannot spot problems as easily then anymore.
Thanks..
nice extension. thanks. ^_^
@fiesh
oh come on!
you are not going to use it in production, so who cares if it validates or not.
@nickcv
Of course not, but in development I make it a principle to always have valid output, it helps me find and trace errors.
Small Bug
Have found a small bug in sessionAsArray().
Described the bug in the extension thread in the forum
Yii Debug Toolbar
Yii 1.1.8
Someone else had problems with the toolbar after update Yii framework to v1.1.8?
Great work
Very handy for debugging Yii projects, thanks for sharing!
Cool
Great extension! Thx!
I used it in all my project.
Enabled switch
Thanks for a great extension!
Seems to me very useful would be a Boolean type switch (enabled => true,false) to turn off the extensions with a single command
Just what I was looking for
Thanks very much for this excellent extension!
Config Setting to Check for allowed User Names
Hi,
I needed a config setting to allow the debug toolbar only for some developer users.
Here is my diff:
[diff] Index: /home/me/myproject/protected/extensions/debugtoolbar/XWebDebugRouter.php =================================================================== --- /home/me/myproject/protected/extensions/debugtoolbar/XWebDebugRouter.php (revision 196) +++ /home/me/myproject/protected/extensions/debugtoolbar/XWebDebugRouter.php (working copy) @@ -446,7 +445,8 @@ class XWebDebugRouter extends CLogRoute { public $config = ''; - public $allowedIPs = array('127.0.0.1'); + public $allowedIPs = array('127.0.0.1'); + public $allowedUserNames = null; public function collectLogs($logger, $processLogs = false) { @@ -458,10 +458,50 @@ public function processLogs($logs) { $app=Yii::app(); - $config = array(); - - if( !in_array($app->request->getUserHostAddress(), $this->allowedIPs) ) return; - + $config = array(); + + // Check for valid username configured? + $allowed = true; + if(count($this->allowedUserNames)>0) { + // Deny display first + $allowed = false; + // Check all configured usernames + foreach($this->allowedUserNames as $allowedUserName) + { + if(Yii::app()->user->name==$allowedUserName) + { + $allowed = true; + break; + } + } + } else { + $allowed = true; + } + if(!$allowed) return; + + $ip = $app->request->getUserHostAddress(); + $allowed = false; + foreach($this->allowedIPs as $pattern) + { + // if found any char other than [0-9] and dot, treat pattern as a regexp + if(preg_match('/[^0-9:\.]/', $pattern)) + { + if(preg_match('/'.$pattern.'/', $ip)) + { + $allowed = true; + break; + } + + } + else if($pattern === $ip) + { + $allowed = true; + break; + } + } + + if(!$allowed) return; + foreach (explode(',', $this->config) as $value) { $value = trim($value);
Regards,
Joachim
Compatibility with CWebServiceAction
Hi
This is an excellent extension (I've been using it since some time and it allows for efficient debugging).
I've just added the following piece of code in the processLogs method to disable the extension for CWebServiceAction as the extra data at the end of the webservice reply is not very appreciated by the client:
if(!$allowed) return; // This line already exists. if($app->getController()->action instanceof CWebServiceAction) { return }
excellent extension
Good job!
Is there a way to display the time for each trace ?
The time is displayed like that
12:57:03.153287
12:57:04.183274
But I want an extra column to display the consumed time
12:57:04.183274 - 12:57:03.153287 = 1.03...
Thanks!
Pull-requests are welcome
@KonApaz, unfortunately I do not have enough time to work on this extension at the moment. But if you want, you can send a pull-request (via Github - https://github.com/cr0t/yiidebugtb) and I'll merge it into the current source code. You're welcome for pull-requests!
great work
I changed these lines to have links more comfortable to use:
debugPanel.php . yiiDebugInfoList h2 a { ... + display: block; } XWebDebugRouter.php protected static function formatArrayAsHtml ($ id, $ values, $ highlight = false) { ... - <h2><a href="#" onclick="yiiWebDebugToggleVisible(\'yiiWDCFG' . $id . '\'); return false;">+</a>' . $id . '</h2>'. + <h2><a href="#" onclick="yiiWebDebugToggleVisible(\'yiiWDCFG' . $id . '\'); return false;">+' . $id . '</a></h2>'.
show sql with bounded values in 1 sql statement ?
Hi,
If there is a way to show sql with bounded values in 1 sql statement ?
Thanks!
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.