定制 error-tag/errortag-laravel 二次开发

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

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

error-tag/errortag-laravel

最新稳定版本:v1.0.9

Composer 安装命令:

composer require error-tag/errortag-laravel

包简介

ErrorTag is an error monitoring and observability platform. This package is the client SDK that captures errors from your Laravel application and sends them to the ErrorTag dashboard for analysis, alerting, and team collaboration.

README 文档

README

Latest Version on Packagist tests GitHub Code Style Action Status Total Downloads

ErrorTag is an error monitoring and observability platform. This package is the client SDK that captures errors from your Laravel application and sends them to the ErrorTag dashboard for analysis, alerting, and team collaboration.

Requirements

  • PHP: 8.1 or higher
  • Laravel: 10.x, 11.x, or 12.x
  • HTTP Client: Guzzle (included with Laravel)

Features

  • Automatic Error Capture - Hooks into Laravel's exception handler
  • Intelligent Error Grouping - Groups similar errors using fingerprints
  • Privacy-First - Sanitizes sensitive data (passwords, tokens, headers)
  • Works Everywhere - Sync mode (no queue required) or async via queue
  • Rich Context - Captures request, user, and application data
  • Circuit Breaker - Prevents infinite loops and server overload
  • Highly Configurable - Sample rates, ignored exceptions, and more
  • Fully Tested - Comprehensive test coverage with Pest

Installation

Install the package via Composer:

composer require error-tag/errortag-laravel

Publish the configuration file:

php artisan vendor:publish --tag="errortag-laravel-config"

Add your ErrorTag API key to .env:

ERRORTAG_KEY=project_xxxxx
ERRORTAG_ENV=production

Quick Start

Once installed, ErrorTag automatically captures all unhandled exceptions.

By default, errors are sent synchronously (no queue worker required). This works perfectly on shared hosting, local development, and production.

Test your setup:

php artisan errortag:test --send-test-error

Queue Configuration (Optional)

For high-traffic applications, you can enable async sending via queue:

ERRORTAG_USE_QUEUE=true
ERRORTAG_QUEUE_CONNECTION=database

Important: Only enable queues if you have workers running via cron or supervisor.

For shared hosting with cron: Add this to your crontab:

* * * * * php /path/to/artisan queue:work --stop-when-empty --tries=2 --max-time=50

Usage

Automatic Capture

// This exception is automatically captured
throw new Exception('Something went wrong!');

Manual Reporting

use ErrorTag\ErrorTag\Facades\ErrorTag;

try {
    processPayment($order);
} catch (Exception $e) {
    ErrorTag::captureException($e);
}

Adding Context

ErrorTag::context([
    'order_id' => $order->id,
    'payment_provider' => 'stripe',
]);

Configuration

Laravel Version Compatibility

Laravel 11+ and 12+ ErrorTag automatically registers via its service provider. You can also manually configure exception reporting in bootstrap/app.php:

->withExceptions(function (Exceptions $exceptions): void {
    // ErrorTag is auto-registered, but you can customize here if needed
})->create();

Laravel 10 and below ErrorTag automatically registers via its service provider using the reportable() method. No manual configuration needed. Just install the package and configure your .env file.

Sync vs Async Sending

Sync Mode (Default - Recommended)

ERRORTAG_USE_QUEUE=false
ERRORTAG_SYNC_TIMEOUT=2  # Fast timeout to avoid blocking requests
  • Works immediately after installation
  • No queue worker required
  • Perfect for shared hosting
  • Great for low-medium traffic

Async Mode (Queue)

ERRORTAG_USE_QUEUE=true
ERRORTAG_QUEUE_CONNECTION=database
ERRORTAG_TIMEOUT=5
  • Better for high-traffic apps
  • Doesn't block user requests
  • Requires queue worker running

Other Options

# Disable ErrorTag in local environment
ERRORTAG_ENABLED=true

# Sample rate (capture 50% of errors)
ERRORTAG_SAMPLE_RATE=0.5

# Don't capture request body (privacy)
ERRORTAG_CAPTURE_BODY=false

# Circuit breaker (stop after 5 failures)
ERRORTAG_CIRCUIT_BREAKER_THRESHOLD=5

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固