此包已被弃用且不再维护。未建议替代包。

Rollbar Yii2 错误处理器

1.0.1 2015-08-14 16:03 UTC

This package is not auto-updated.

Last update: 2017-01-14 10:52:17 UTC


README

安装此扩展的首选方法是使用 composer

可以运行

php composer.phar require --prefer-dist ladamalina/yii2-rollbar "*"

或者添加

"ladamalina/yii2-rollbar": "*"

到您的 composer.json 文件的 require 部分中。

用法

所有这些块都可以包含在一个配置文件(对于相当简单的应用程序,可以是 frontend/config/main-local.php)中,但在这里我将描述为真正的“高级”怪物(例如我们的选举平台)的安装过程。

您最全局的主.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/config/main-local.php)

'components' => [
  'errorHandler' => [
      // handling uncaught PHP exceptions, execution and fatal errors
      'class' => 'ladamalina\yii2_rollbar\ConsoleErrorHandler',
  ],
],

它是否有效?

您只需为数据库连接编写不正确的设置,刷新网站页面或执行任何控制台命令。Rollbar 问题将在几秒钟内出现在仪表板中。