Yii Debugger is one of the new feature of Yii 2 framework. When this extension is used, a debugger toolbar will appear at the bottom of every page. The extension also provides a set of standalone pages to display more detailed debug information and by default, this feature wasn’t activated.

1. Activate yii 2 debugger tool.

To use the yii debugger tool, we need to enable it. By default, the yii debugger tool is declined our IP address, so to activate it, we must add our IP address inside the Yii debugger module.

Basic template.

Go to config/web.php and replace the existing code with this one:

if (!YII_ENV_TEST) {
 // configuration adjustments for 'dev' environment
 $config['bootstrap'][] = 'debug';
 // $config['modules']['debug'] = 'yiidebugModule';
 $config['modules']['debug'] = [
   'class' => 'yiidebugModule',
   'allowedIPs' => ['127.0.0.1', '::1'],
 ];
}

Advanced template.

Go to backend/config/main-local.php and replace the existing code, because the yii debugger tool is only for development environment, so I think it’s better to display it only in back-end side.

if (!YII_ENV_TEST) {
 // configuration adjustments for 'dev' environment
 $config['bootstrap'][] = 'debug';
 // $config['modules']['debug'] = 'yiidebugModule';
 $config['modules']['debug'] = [
   'class' => 'yiidebugModule',
   'allowedIPs' => ['127.0.0.1', '::1'],
 ];
}

2. How to use the Yii 2 debugger tool.

By go to /admin/debug/default/index , we can access the yii 2 debugger tool page.

Yii 2 debugger

All of our action in the website is logged by Yii debugger, you can see here get/post request from which page to which page.

By clicking in tag , you can see the exactly the value of each request like $_GET, $_POST, $_COOKIE, Server.

Yii 2 debugger parameter

Yii 2 debugger tool is very useful when you develops your website, tracking your parameters when an error appear. Or reduce your request to make your website is more faster.