mbs047 / error-guardian
Adaptive, multi-tenant friendly error monitoring & notification package for Laravel.
dev-main
2025-08-23 15:17 UTC
Requires
- php: >=8.1
- guzzlehttp/guzzle: ^7.0
- illuminate/notifications: ^10.0|^11.0
- illuminate/queue: ^10.0|^11.0
- illuminate/support: ^10.0|^11.0
This package is auto-updated.
Last update: 2025-08-23 15:17:28 UTC
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\Classifier
with your own binding. - Add custom notification channels by implementing
NotificationChannel
and binding in your app.