ai-error-laravel maintained by emberrenewed
Description
Enterprise-grade AI-powered error analysis, monitoring and auto-fix suggestions for Laravel 13 applications. Combines Telescope-style observability with multi-provider AI (OpenAI, Gemini, Claude, Ollama).
Author
Last update
2026/05/27 05:20
(dev-main)
License
Downloads
7
Tags
debugging - monitoring - laravel - ai - exception-handler - gemini - telescope - observability - openai - claude - ollama - laravel-13 - auto-fix - error-analyzer
Laravel AI Error Analyzer
Telescope-grade observability + multi-provider AI explanations, root-cause analysis and auto-fix suggestions for Laravel 11/12/13.
✨ Features
- 🤖 Multi-provider AI — OpenAI, Gemini, Claude, Ollama, plus custom drivers
- 🪞 Beautiful dashboard — TailwindCSS + Alpine.js, dark mode, glassmorphism
- 🚀 Realtime —
ShouldBroadcastevents for Reverb / Pusher / Soketi - 🧠 Smart deduplication — fingerprint-based, identical errors share AI analysis
- 🛡️ Security first — gated dashboard, encrypted runtime settings, redacted secrets
- 🔔 Notifications — Slack, Discord, Telegram, Mail with severity gating
- 🧰 Artisan kit —
install,test,scan,clear,analyze,monitor - 🧪 Pest + PHPUnit — full test suite, GitHub Actions matrix
- 🐳 Docker — turnkey compose for local Ollama dev
🚀 Quick start
composer require emberrenewed/ai-error-laravel
php artisan ai-errors:install
AI_ERROR_ANALYZER_PROVIDER=openai
OPENAI_API_KEY=sk-...
AI_ERROR_ANALYZER_EMAILS=you@example.com
Run the queue worker that handles AI calls:
php artisan queue:work --queue=ai-errors
Visit /ai-errors in your browser. Done.
📸 Screenshots
Drop screenshots into
docs/screenshots/and link them here:
docs/screenshots/
├── overview.png
├── error-detail.png
├── chat.png
└── settings.png
🧠 What the AI returns
For every captured exception you get a structured analysis:
{
"summary": "Eloquent could not find a User with id 42.",
"root_cause": "The `firstOrFail()` call is hit when the requested user has been soft-deleted...",
"severity": "medium",
"suggested_fixes": ["Use `withTrashed()->find($id)`", "..."],
"example_code": "User::withTrashed()->findOrFail($id);",
"prevention_tips": ["Add a deleted-at index", "..."],
"documentation_links": ["https://laravel.com/docs/eloquent#soft-deleting"],
"security_warnings": [],
"performance_impact": null,
"auto_fix_patch": "--- a/app/Http/Controllers/UserController.php\n+++ b/...",
"related_files": ["app/Http/Controllers/UserController.php"]
}
🏗️ Architecture
┌──────────────┐ Log::error ┌────────────────────────┐
│ App code │─────────────▶│ CaptureExceptionListener│
└──────────────┘ └──────────┬─────────────┘
▼
┌──────────────────────────┐
│ ErrorAnalysisEngine │
│ • build context │
│ • fingerprint │
│ • persist (repository) │
└──────┬────────────┬──────┘
▼ ▼
┌──────────────────┐ ┌──────────────────┐
│ AnalyzeErrorJob │ │ ErrorCaptured ⏤ │ broadcast
└────────┬─────────┘ └──────────────────┘
▼
┌─────────────────────┐
│ AiProviderManager │ → OpenAI / Gemini / Claude / Ollama
└─────────┬───────────┘
▼
┌────────────────────┐
│ AiAnalysisResult │ → Repository → ErrorAnalyzed event → Notifications
└────────────────────┘
🧰 Artisan commands
| Command | Description |
|---|---|
ai-errors:install |
Publish config/migrations and run them |
ai-errors:test |
Smoke-test the configured AI provider |
ai-errors:scan |
Backfill from storage/logs/laravel.log |
ai-errors:analyze {id} |
Re-run AI analysis on a specific log |
ai-errors:clear |
Purge logs older than retention |
ai-errors:monitor |
Tail recent errors in the terminal |
🛡️ Security
- Dashboard requires the
viewAiErrorAnalyzerGate (default: emails allow-list, local-only fallback). - API guarded by middleware + rate limiter.
- Secrets in
ai_error_settingsare encrypted viaAPP_KEY. - Secrets in payloads (
password,token,authorization, ...) are redacted before storage.
Read SECURITY.md for disclosure policy.
🤝 Contributing
PRs welcome — see CONTRIBUTING.md. Please run:
vendor/bin/pint
vendor/bin/phpstan analyse
vendor/bin/pest
📜 License
MIT — see LICENSE.