emberrenewed/ai-error-laravel

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).

Maintainers

Package info

github.com/emberrenewed/Ai-error-Laravel

Documentation

pkg:composer/emberrenewed/ai-error-laravel

Statistics

Installs: 7

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-05-27 03:20 UTC

This package is auto-updated.

Last update: 2026-05-27 03:30:48 UTC


README

Laravel AI Error Analyzer

Telescope-grade observability + multi-provider AI explanations, root-cause analysis and auto-fix suggestions for Laravel 11/12/13.

Latest Version on Packagist Tests License PHP

✨ Features

  • πŸ€– Multi-provider AI β€” OpenAI, Gemini, Claude, Ollama, plus custom drivers
  • πŸͺž Beautiful dashboard β€” TailwindCSS + Alpine.js, dark mode, glassmorphism
  • πŸš€ Realtime β€” ShouldBroadcast events 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 viewAiErrorAnalyzer Gate (default: emails allow-list, local-only fallback).
  • API guarded by middleware + rate limiter.
  • Secrets in ai_error_settings are encrypted via APP_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.