Download the PHP package kolakachi/laravel-error-explainer without Composer
On this page you can find all versions of the php package kolakachi/laravel-error-explainer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kolakachi/laravel-error-explainer
More information about kolakachi/laravel-error-explainer
Files in kolakachi/laravel-error-explainer
Package laravel-error-explainer
Short Description Turn Laravel exceptions into dev-friendly explanations and user-safe messages using your own LLM keys. Multi-provider, multi-language.
License MIT
Informations about the package laravel-error-explainer
Laravel Error Explainer
Turn Laravel exceptions into two things, automatically:
- A dev message — what broke, where, and a suggested fix, grounded in your actual stack trace and code.
- A user message — a calm, non-technical sentence safe to show on your 500 page.
Bring your own LLM key (OpenAI, Anthropic), point OpenAI at an OpenAI-compatible endpoint, or run fully local with Ollama. Output in any language.
Install
Set your driver and key in .env:
That's it. The package hooks your exception handler via reportable(). When an exception is reported in an enabled environment, the explanation is generated (cached by error signature) and written to your log. In queue mode the package serializes a scrubbed payload and dispatches a real queued job instead of blocking the request:
In sync mode, the current explanation is also shared with the view layer by default:
errorExplainerExplanationerrorExplainerUserMessage
If you want the package to render its own simple HTML error page for server-side exceptions, enable:
The built-in page can also show the developer explanation while APP_DEBUG=true, or you can force it on with:
Manual use
Error Page Integration
For a custom Laravel error page, you can render the current safe message with the built-in component:
You can also read the shared view data directly if you prefer:
With ERROR_EXPLAINER_RENDER_ERROR_PAGE=true, the package can also return its own built-in HTML error page for non-JSON 5xx responses. The page renders even when no explanation is available (for example in production, where explanations are gated off, or if the LLM call fails) — it falls back to the view.fallback_message config value and hides the developer panel. So you can use it as a plain branded 500 page and let the AI message fill in wherever explanations run.
Custom LLM providers
Then set ERROR_EXPLAINER_DRIVER=gemini.
If your provider exposes an OpenAI-compatible API, you can often use the built-in openai driver instead:
Privacy
Before anything is sent to a provider, the payload passes through a regex scrubber (scrub_patterns in config) that redacts passwords, bearer tokens, API keys, and emails by default. Add your own patterns. For zero data egress, use the ollama driver — inference stays on your machine.
Cost control
Explanations are cached by exception signature (class + file + line + normalized message), so an exception firing 10,000 times in a hot loop costs you one LLM call. Numeric IDs in messages are normalized, so User 42 not found and User 99 not found share a cache entry.
Filtering
Skip noisy or intentional exceptions with except, and by default anything implementing Laravel's ShouldntReport contract is ignored automatically:
Testing
Built for Orchestra Testbench + Pest:
License
MIT
All versions of laravel-error-explainer with dependencies
illuminate/contracts Version ^11.0|^12.0
illuminate/support Version ^11.0|^12.0
illuminate/http Version ^11.0|^12.0
illuminate/cache Version ^11.0|^12.0