emgiezet/errbit-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

emgiezet/errbit-php

Composer 安装命令:

composer require emgiezet/errbit-php

包简介

errbit/airbrake integration with php with psr-2

README 文档

README

Coverage Status Build Status Latest Stable Version SymfonyInsight

This is a full-featured client to add integration with Errbit (or Airbrake) to any PHP 8.2+ application.

PHP Version Requirements

Library Version PHP Version
1.x PHP 5.3
2.x PHP 8.0, 8.1
3.x PHP 8.2, 8.3, 8.4 (recommended)

Original idea and source has no support for php namespaces. Moreover it has a bug and with newest errbit version the xml has not supported chars.

What is for?

Handling your errors and passing them to the Error Retention tool called Errbit. It's a free alternative of sentry.io or airbrake.io. Check the presentation below!

Huston whe have an Airbrake

Upgrading to v3.0

Version 3.0 contains breaking changes. If you're upgrading from v2.x, please note:

  • PHP 8.0 and 8.1 support has been dropped - Minimum PHP version is now 8.2
  • Removed ErrorInterface - Use \Throwable type hints instead
  • Changed WriterInterface::write() signature - Now accepts \Throwable instead of ErrorInterface
  • Updated error class constructors - Notice, Warning, Error, Fatal now use named parameters

ChangeLog

Check the:

Installation

Composer Way

For PHP 5.3

require: {
    "emgiezet/errbit-php": "1.*"
}

For PHP 8.0, 8.1

require: {
    "emgiezet/errbit-php": "2.*"
}

For PHP 8.2+ (recommended)

require: {
    "emgiezet/errbit-php": "^3.0"
}

Usage

To setup an Errbit instance you need to configure it with an array of parameters. Only two of them are mandatory.

use Errbit\Errbit;

Errbit::instance()
  ->configure(array(
    'api_key'           => 'YOUR API KEY',
    'host'              => 'YOUR ERRBIT HOST, OR api.airbrake.io FOR AIRBRAKE'
  ))
  ->start();

View the full configuration.

This will register error handlers:

set_error_handler();
set_exception_handler();
register_shutdown_function();

And log all the errors intercepted by handlers to your errbit.

If you want to notify an exception manually, you can call notify() without calling a start(). That way you can avoid registering the handlers.

use Errbit\Errbit;

try {
  somethingErrorProne();
} catch (Exception $e) {
  Errbit::instance()->notify(
    $e,
    array('controller'=>'UsersController', 'action'=>'show')
  );
}

Using your own error handler

If you don't want Errbit to install its own error handlers and prefer to use your own, you can just leave out the call to start(), then wherever you catch an Exception (note the errors must be converted to Exceptions), simply call

use Errbit\Errbit;
Errbit::instance()->notify($exception);

With this type of use. Library will not handle the errors collected by:

set_error_handler();
register_shutdown_function();

Using only some of the default handlers

There are three error handlers installed by Errbit: exception, error and fatal.

By default all three are used. If you want to use your own for some handlers, but not for others, pass the list into the start() method.

use Errbit\Errbit;
Errbit::instance()->start(array('error', 'fatal')); // using our own exception handler

Symfony Integration

Symfony 7

See the Symfony 7 integration guide for modern Symfony 7+ integration using PHP attributes and best practices.

Symfony 2

See the Symfony 2 documentation for legacy Symfony 2 integration.

Kohana 3.3 Integration

check out the kohana-errbit for kohana 3.3 integration.

Symfony 1.4 Integration

No namespaces in php 5.2 so this library can't be used. Go to filipc/sfErrbitPlugin and monitor your legacy 1.4 applications.

License & Copyright

Copyright © mmx3.pl 2013 Licensed under the MIT license. Based on idea of git://github.com/flippa/errbit-php.git but rewritten in 90%.

Contributors

https://github.com/emgiezet/errbitPHP/graphs/contributors

Rest of the contributors: Author: emgiezet Contributors page

emgiezet/errbit-php 适用场景与选型建议

emgiezet/errbit-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 147.43k 次下载、GitHub Stars 达 44, 最近一次更新时间为 2013 年 09 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「airbrake」 「errbit」 「error tracking」 「errbit php」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 emgiezet/errbit-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 emgiezet/errbit-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 emgiezet/errbit-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 147.43k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 44
  • 点击次数: 23
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 44
  • Watchers: 4
  • Forks: 14
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-09-30