module-debug.md 1.13 KB
Newer Older
1 2 3
Debug toolbar and debugger
==========================

4 5 6 7 8 9
Yii2 includes a handy toolbar to aid faster development and debugging as well as debugger. Toolbar displays information
about currently opened page while using debugger you can analyze data collected before.

Installing and configuring
--------------------------

docsolver committed
10 11
Add these lines to your config file:

Qiang Xue committed
12
```php
13 14 15 16
'preload' => ['debug'],
'modules' => [
	'debug' => ['yii\debug\Module']
]
docsolver committed
17 18
```

Qiang Xue committed
19 20
> Note: by default the debug module only works when browsing the website from the localhost. If you want to use it
> on a remote (staging) server, add the parameter allowedIPs to the config to whitelist your IP, e.g. :**
21

Qiang Xue committed
22
```php
23 24 25
'preload' => ['debug'],
'modules' => [
	'debug' => [
Qiang Xue committed
26 27
		'class' => 'yii\debug\Module',
		'allowedIPs' => ['1.2.3.4', '127.0.0.1', '::1']
28 29 30
	]
]
```
31

32 33 34 35 36 37 38 39 40 41 42 43
If you are using `enableStrictParsing` URL manager option, add the following to your `rules`:

```php
'urlManager' => [
	'enableStrictParsing' => true,
	'rules' => [
		// ...
		'debug/<controller>/<action>' => 'debug/<controller>/<action>',
	],
],
```

44 45 46
How to use it
-------------

docsolver committed
47

48 49 50
Creating your own panels
------------------------