mbs047/error-guardian
Composer 安装命令:
composer require mbs047/error-guardian
包简介
Adaptive, multi-tenant friendly error monitoring & notification package for Laravel.
README 文档
README
Adaptive, multi-tenant friendly error monitoring & notification package for Laravel.
Features
- Single-tenant or multi-tenant aware via pluggable
TenantResolver - Classification → severity/category routing
- Rate limiting & circuit breaker to avoid floods
- Slack, Discord, Email channels (extensible)
- Minimal host changes (trait for app
Handler) - Jobs & commands for maintenance and health
Install
composer require your-vendor/error-guardian php artisan vendor:publish --tag=error-guardian-config php artisan vendor:publish --tag=error-guardian-migrations php artisan migrate php artisan error-guardian:install
Hook into your Exception Handler
In app/Exceptions/Handler.php:
use ErrorGuardian\Support\Concerns\HandlesWithErrorGuardian; class Handler extends ExceptionHandler { use HandlesWithErrorGuardian; }
(Optional) Middleware
Register the middleware to attach a request id:
\ErrorGuardian\Http\Middleware\ErrorContextMiddleware::class
Configure Tenancy
Bind or configure a tenant resolver (default is NullTenantResolver for single-tenant):
// e.g., in a service provider $this->app->bind(\ErrorGuardian\Contracts\TenantResolver::class, function () { return new class implements \ErrorGuardian\Contracts\TenantResolver { public function tenantId(): ?string { return optional(auth()->user())->tenant_id; } public function context(): array { return []; } }; });
Test
php artisan error-guardian:test
Extending
- Replace
ErrorGuardian\Contracts\Classifierwith your own binding. - Add custom notification channels by implementing
NotificationChanneland binding in your app.
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-23