senyor / yii2-debug
Yii框架的调试扩展
2.0.13
2017-12-05 07:36 UTC
Requires
- yiisoft/yii2: ~2.0.13
- yiisoft/yii2-bootstrap: ~2.0.0
This package is not auto-updated.
Last update: 2024-09-21 16:03:10 UTC
README
Yii 2调试扩展
本扩展为Yii框架2.0应用程序提供了一个调试器。当使用此扩展时,会在每个页面的底部显示一个调试工具栏。该扩展还提供了一组独立页面以显示更详细的调试信息。
有关许可证信息,请参阅LICENSE文件。
文档位于docs/guide/README.md。
安装
安装此扩展的首选方法是使用composer。
运行以下命令:
php composer.phar require --prefer-dist yiisoft/yii2-debug
或者将以下内容添加到您的composer.json文件的require部分:
"yiisoft/yii2-debug": "~2.0.0"
使用
使用
扩展安装后,只需按照以下方式修改您的应用程序配置
return [ 'bootstrap' => ['debug'], 'modules' => [ 'debug' => [ 'class' => 'yii\debug\Module', // uncomment and adjust the following to add your IP if you are not connecting from localhost. //'allowedIPs' => ['127.0.0.1', '::1'], ], // ... ], ... ];
您将在应用程序每个页面的底部看到调试工具栏。您可以点击工具栏以查看更多详细的调试信息。
在IDE中打开文件
您可以使用此配置创建链接以在您喜欢的IDE中打开文件
return [ 'bootstrap' => ['debug'], 'modules' => [ 'debug' => [ 'class' => 'yii\debug\Module', 'traceLine' => '<a href="phpstorm://open?url={file}&line={line}">{file}:{line}</a>', // uncomment and adjust the following to add your IP if you are not connecting from localhost. //'allowedIPs' => ['127.0.0.1', '::1'], ], // ... ], ... ];
您必须对您的操作系统进行一些修改。请参阅以下示例
- PHPStorm:https://github.com/aik099/PhpStormProtocol
- Windows或Linux上的Sublime Text 3:https://packagecontrol.io/packages/subl%20protocol
- Mac上的Sublime Text 3:https://github.com/inopinatus/sublime_url
虚拟化或docker化
如果您的应用程序在虚拟化或docker化环境中运行,通常情况下,虚拟机或容器内的应用程序基本路径与宿主机的不同。为了在这些情况下使链接工作,您可以按照以下方式配置traceLine(将路径更改为您的应用程序路径)
'traceLine' => function($options, $panel) { $filePath = str_replace(Yii::$app->basePath, '~/path/to/your/app', $options['file']); return strtr('<a href="ide://open?url=file://{file}&line={line}">{text}</a>', ['{file}' => $filePath]); },