定制 rustem-kaimolla/laravel-exception-reporter 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

rustem-kaimolla/laravel-exception-reporter

Composer 安装命令:

composer require rustem-kaimolla/laravel-exception-reporter

包简介

Laravel package to report exceptions via TCP

README 文档

README

Laravel Exception Reporter

LLM exception analysis and automatic creation of incident as bug in Jira

Total Downloads

A simple exception reporting agent for Laravel applications that sends exceptions to a remote Exception Reporter Agent service https://github.com/rustem-kaimolla/exception-reporter-agent.

Installation

Install via Composer:

composer require rustem-kaimolla/laravel-exception-reporter

Publish the config file:

php artisan vendor:publish --tag=exception-reporter-config

Configuration

After publishing, configure the following values in your .env file:

EXCEPTION_REPORTER_ENABLED=true
EXCEPTION_TCP_HOST=127.0.0.1
EXCEPTION_TCP_PORT=9000

Or configure directly in config/exception-reporter.php:

return [
    'enabled' => env('EXCEPTION_REPORTER_ENABLED', true),
    'endpoint' => env('EXCEPTION_REPORTER_ENDPOINT'),
    'token' => env('EXCEPTION_REPORTER_TOKEN'),
];

Usage

To report exceptions to the agent, you must manually call the reporter in your App\Exceptions\Handler:

use Throwable;
use ExceptionReporter;

public function report(Throwable $exception)
{
    ExceptionReporter::report($exception); // Send exception to the agent
    parent::report($exception); // Continue Laravel's default reporting
}

Advanced Integration (Optional)

If you want automatic reporting without modifying your exception handler, you can:

  1. Create a custom ExceptionHandler and bind it in the service container:
app()->singleton(
    \Illuminate\Contracts\Debug\ExceptionHandler::class,
    \App\Exceptions\CustomHandler::class
);
  1. Subscribe to Laravel's internal exception events:
use Illuminate\Foundation\Exceptions\Events\ExceptionOccurred;
use Illuminate\Support\Facades\Event;
use ExceptionReporter;

Event::listen(ExceptionOccurred::class, function ($event) {
    ExceptionReporter::report($event->exception);
});

Note: For production use, it's recommended to use the manual report() override for more control.

License

MIT License. See LICENSE for more details.

Contributions

Pull requests are welcome. Please open issues for feature suggestions or bugs.

Made with ❤️ for Laravel developers who hate debugging twice.

统计信息

  • 总下载量: 38
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-08-05