ladamalina / yii2-rollbar
Rollbar Yii2 错误处理器
dev-master
2021-04-14 10:02 UTC
Requires
- php: >=5.4
- rollbar/rollbar: ~0.11
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-09-14 17:42:39 UTC
README
安装此扩展的最佳方式是通过composer。
运行以下命令之一:
php composer.phar require --prefer-dist ladamalina/yii2-rollbar "*"
或者在您的composer.json
文件的require部分添加:
"ladamalina/yii2-rollbar": "*"
到
使用说明
所有这些块都可以包含在一个配置文件中(适用于相当简单的应用程序的frontend/config/main-local.php),但在这里我描述了为真正的“高级”应用程序(如我们的选举平台)的安装过程。
您最全局的main.php文件
'bootstrap' => ['rollbar'], 'components' => [ 'rollbar' => [ 'class' => 'ladamalina\yii2_rollbar\RollbarComponent', 'accessToken' => 'POST_SERVER_ITEM_ACCESS_TOKEN', ], ],
main-local.php(适用于高级应用程序模板的common/config/main-local.php)
'components' => [ 'rollbar' => [ 'environment' => 'production', // you environment name ], ],
web错误处理器(适用于高级应用程序模板的frontend/config/main-local.php)
'components' => [ 'errorHandler' => [ // handling uncaught PHP exceptions, execution and fatal errors 'class' => 'ladamalina\yii2_rollbar\WebErrorHandler', ], ],
console错误处理器(适用于高级应用程序模板的console/config/main-local.php)
'components' => [ 'errorHandler' => [ // handling uncaught PHP exceptions, execution and fatal errors 'class' => 'ladamalina\yii2_rollbar\ConsoleErrorHandler', ], ],
它是否工作?
您只需写入错误的数据库连接设置并刷新网站页面或执行任何控制台命令。Rollbar问题将在几秒钟后出现在仪表板中。