madsleejensen/opbeat-php

PHP 的 Opbeat 包装器

v2.1.4 2016-04-07 09:47 UTC

This package is not auto-updated.

Last update: 2024-09-14 17:21:25 UTC


README

一个用于与 Opbeat 服务通信的简单库。

安装

使用 Composer 安装此库

composer require madsleejensen/opbeat-php

配置

您需要提供一个实现 Illuminate/Contracts/Config/Repository 的配置处理程序。

当初始化 Client 时传递此配置处理程序的实例。

Opbeat\Client 需要以下设置

  • opbeat.organization_id (字符串)
  • opbeat.app_id (字符串)
  • opbeat.access_token (字符串)

以下设置是可选的,并具有默认值

  • opbeat.enable_exception_handler (布尔值,默认: true)
  • opbeat.enable_error_handler (布尔值,默认: true)

启用客户端

设置好配置后,只需创建一个 Opbeat\Client 的实例。除非您将 enable_exception_handlerenable_error_handler 设置为 false,否则客户端将自动注册处理程序以处理两者。

$client = new \Opbeat\Client($config);

手动捕获异常

您还可以手动捕获异常。为此,Opbeat\Client 提供了 catchException 方法。

public void catchException ( Exception $exception )

贡献

如果您遇到任何问题或有改进的想法,请提交一个 pull request 或 issue。

pull request 必须遵循 PSR-2,类必须遵循 PSR-4 命名方案,并以 Opbeat 作为命名空间前缀。