定制 error-explorer/laravel 二次开发

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

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

error-explorer/laravel

Composer 安装命令:

composer require error-explorer/laravel

包简介

Error Explorer SDK for Laravel - Automatic error tracking with breadcrumbs

README 文档

README

Official Laravel SDK for Error Explorer - Automatic error tracking with breadcrumbs.

Requirements

  • PHP 8.1+
  • Laravel 10.x or 11.x

Installation

composer require error-explorer/laravel

The service provider is automatically discovered. No manual registration needed.

Configuration

1. Set your token

Add to your .env file:

ERROR_EXPLORER_TOKEN=your_project_token

2. Publish config (optional)

php artisan vendor:publish --tag=error-explorer-config

Usage

Automatic Capture

The SDK automatically captures:

  • Exceptions - All unhandled exceptions
  • HTTP Requests - Request/response breadcrumbs
  • User Context - Authenticated user info
  • Log Entries - Via custom log channel (optional)

Manual Enrichment

use ErrorExplorer\Laravel\Facades\ErrorExplorer;

// Add custom breadcrumb
ErrorExplorer::addBreadcrumb([
    'type' => 'user-action',
    'message' => 'User clicked checkout',
    'data' => ['cartTotal' => 149.99]
]);

// Set user context (overrides auto-detected)
ErrorExplorer::setUser([
    'id' => 'user_123',
    'email' => 'john@example.com',
    'plan' => 'pro'
]);

// Add tags for filtering
ErrorExplorer::setTags([
    'feature' => 'checkout',
    'version' => '2.0'
]);

// Add extra context
ErrorExplorer::setExtra([
    'orderId' => 'order_789'
]);

// Capture exception manually
try {
    // risky operation
} catch (Exception $e) {
    ErrorExplorer::captureException($e);
}

// Capture message
ErrorExplorer::captureMessage('Something noteworthy happened', 'info');

Log Channel Integration

Add the Error Explorer channel to your config/logging.php:

'channels' => [
    'stack' => [
        'driver' => 'stack',
        'channels' => ['daily', 'error-explorer'],
    ],

    'error-explorer' => [
        'driver' => 'custom',
        'via' => \ErrorExplorer\Laravel\Logging\ErrorExplorerLogHandler::class,
        'level' => 'debug',
    ],
],

Configuration Options

// config/error-explorer.php

return [
    // Enable/disable the SDK
    'enabled' => env('ERROR_EXPLORER_ENABLED', true),

    // Authentication
    'token' => env('ERROR_EXPLORER_TOKEN'),
    'dsn' => env('ERROR_EXPLORER_DSN'),

    // Environment & Release
    'environment' => env('APP_ENV', 'production'),
    'release' => env('APP_VERSION'),

    // What to capture
    'capture' => [
        'exceptions' => true,
        'errors' => true,
        'fatal_errors' => true,
    ],

    // Breadcrumbs
    'breadcrumbs' => [
        'max_breadcrumbs' => 50,
        'http_requests' => true,
        'logs' => true,
        'queries' => true,
    ],

    // Context
    'context' => [
        'user' => true,
        'request' => true,
        'server' => true,
    ],

    // Transport
    'transport' => [
        'async' => true,
        'timeout' => 3,
        'retry' => 2,
    ],

    // Data scrubbing
    'scrub_fields' => [
        'password',
        'password_confirmation',
        'token',
        'api_key',
    ],

    // Ignored exceptions
    'ignore' => [
        'exceptions' => [
            \Illuminate\Auth\AuthenticationException::class,
            \Illuminate\Validation\ValidationException::class,
            // ...
        ],
    ],
];

HMAC Authentication

For enhanced security:

ERROR_EXPLORER_HMAC_ENABLED=true
ERROR_EXPLORER_HMAC_SECRET=your_hmac_secret

Testing

composer test

License

MIT License. See LICENSE for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-03