errorvault/laravel 问题修复 & 功能扩展

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

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

errorvault/laravel

Composer 安装命令:

composer require errorvault/laravel

包简介

ErrorVault error logging package for Laravel applications

README 文档

README

Send PHP exceptions to your ErrorVault dashboard for centralized error monitoring with automatic health monitoring and reliability features.

Installation

composer require errorvault/laravel

Configuration

Publish the config file:

php artisan vendor:publish --tag=errorvault-config

Add these environment variables to your .env file:

ERRORVAULT_ENABLED=true
ERRORVAULT_API_ENDPOINT=https://your-errorvault-portal.com/api/v1/errors
ERRORVAULT_API_TOKEN=your-site-api-token

Usage

Once configured, exceptions are automatically reported to ErrorVault. You can also manually report errors:

use ErrorVault\Laravel\Facades\ErrorVault;

// Report a custom error
ErrorVault::reportError('Something went wrong', 'warning', __FILE__, __LINE__);

// Report with additional context
ErrorVault::reportError(
    'Payment failed',
    'critical',
    __FILE__,
    __LINE__,
    ['order_id' => $orderId, 'amount' => $amount]
);

// Manually report an exception
try {
    // risky operation
} catch (\Exception $e) {
    ErrorVault::report($e, ['custom' => 'context']);
}

Verify Connection

use ErrorVault\Laravel\Facades\ErrorVault;

$result = ErrorVault::verify();

if ($result['success']) {
    echo "Connected to: " . $result['data']['site_name'];
} else {
    echo "Error: " . $result['error'];
}

Get Statistics

$stats = ErrorVault::stats();

if ($stats) {
    echo "Total errors: " . $stats['total_errors'];
    echo "New errors: " . $stats['new_errors'];
}

Reliability Features (v1.3.0+)

Automatic Heartbeat

The package automatically sends a lightweight ping every 5 minutes to keep your site's last_seen_at updated in the portal. This prevents your site from appearing offline.

Connection Failure Tracking

All API connection failures are automatically logged with:

  • Timestamp and error message
  • Consecutive failure counter
  • Last 20 failures stored
  • Admin notification after 5 consecutive failures

Artisan Commands

Test Connection

php artisan errorvault:test-connection

Tests connectivity to the ErrorVault portal and displays detailed results.

View Diagnostics

php artisan errorvault:diagnostics

Displays comprehensive diagnostics including:

  • Configuration status
  • Health monitoring settings
  • Connection failure history
  • Scheduled task information

Clear Failure Logs

php artisan errorvault:diagnostics --clear-failures

Clears all connection failure logs.

Send Health Report

php artisan errorvault:health-report

Manually trigger a health report to the portal.

Programmatic Access

use ErrorVault\Laravel\Facades\ErrorVault;

// Test connection
$result = ErrorVault::testConnection();
if ($result['success']) {
    echo "Connection successful!";
}

// Get connection failures
$failures = ErrorVault::getConnectionFailures();
foreach ($failures as $failure) {
    echo $failure['timestamp'] . ': ' . $failure['message'];
}

// Get consecutive failure count
$count = ErrorVault::getConsecutiveFailures();

// Clear failure logs
ErrorVault::clearFailureLog();

// Send heartbeat/ping
ErrorVault::sendPing(); // Non-blocking
ErrorVault::sendPing(true); // Blocking

Health Monitoring

Enable comprehensive server health monitoring:

ERRORVAULT_HEALTH_ENABLED=true
ERRORVAULT_CPU_THRESHOLD=80
ERRORVAULT_MEMORY_THRESHOLD=80
ERRORVAULT_REQUEST_RATE_THRESHOLD=1000
ERRORVAULT_HEALTH_INTERVAL=5

Health monitoring tracks:

  • CPU load and usage
  • Memory consumption
  • Request rates and traffic spikes
  • Disk space
  • Potential DDoS attacks

Reports are automatically sent every 5 minutes (configurable) and alerts are triggered when thresholds are exceeded.

Configuration Options

Basic Options

Option Description Default
enabled Enable/disable reporting false
api_endpoint Your ErrorVault API endpoint ''
api_token Your site's API token ''
send_immediately Send errors immediately vs batch true
ignore Exception classes to ignore See config
ignore_patterns Message patterns to ignore []
severity_map Map exceptions to severities []

Health Monitoring Options

Option Description Default
health_monitoring.enabled Enable health monitoring false
health_monitoring.cpu_load_threshold CPU load alert threshold (%) 80
health_monitoring.memory_threshold Memory usage alert threshold (%) 80
health_monitoring.request_rate_threshold Request rate alert (req/min) 1000
health_monitoring.request_spike_multiplier Traffic spike multiplier 5
health_monitoring.alert_cooldown Alert cooldown (minutes) 15
health_monitoring.report_interval Report interval (minutes) 5
health_monitoring.disk_threshold Disk usage alert threshold (%) 90

Ignoring Exceptions

Add exceptions to the ignore array in config/errorvault.php:

'ignore' => [
    \App\Exceptions\IgnoredException::class,
],

Or use patterns to ignore by message content:

'ignore_patterns' => [
    'deprecated',
    'cache miss',
],

Scheduled Tasks

The package automatically registers the following scheduled tasks:

  1. Heartbeat (every 5 minutes) - Keeps site active in portal
  2. Health Report (configurable, default 5 minutes) - Sends health metrics

Ensure your Laravel scheduler is running:

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

Or use Laravel's queue worker in production.

Version History

  • 1.3.0 - Added heartbeat/ping system, connection failure tracking, diagnostics commands, and reliability improvements
  • 1.2.0 - Added comprehensive server health monitoring
  • 1.1.0 - Enhanced error context and server information
  • 1.0.0 - Initial release

License

MIT

errorvault/laravel 适用场景与选型建议

errorvault/laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 949 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 29 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 errorvault/laravel 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

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