- What does raffaelecarelle/php-error-insight actually do?
- It is a lightweight PHP package that takes PHP errors, warnings and exceptions and turns them into plain-language reports with context-aware explanations and suggested fixes. Instead of only showing a raw stack trace, it sends the error details to an LLM, either local or through an API, and returns a readable summary of what likely went wrong. It is most useful when you are staring at a deep Laravel stack trace and want a faster read on the root cause.
- How do I install php-error-insight with Composer?
- Install it with Composer by requiring raffaelecarelle/php-error-insight in your project. In a Laravel application, check the README for whether the package ships a service provider that is auto-discovered or whether you need to register it manually in your bootstrap configuration. After installing, publish any provided configuration file so you can point it at your chosen LLM provider.
- Which PHP and Laravel versions are supported?
- Because the package is plain PHP rather than framework-specific, it should work inside any Laravel version that runs a PHP version satisfying the constraint declared on Packagist. Before installing, compare your app's PHP version with the package requirements and run Composer's dependency check if you hit a conflict. If you are on an older Laravel release, test it in a staging copy first rather than assuming compatibility.
- Can I use a local LLM like Ollama instead of a cloud API?
- Yes, the package is designed to work with either a local LLM or an API-based provider. Using a local model keeps your error data, stack traces and file paths on your own machine, which is often preferable during development or on sensitive codebases. The trade-off is that local model quality and speed depend on the hardware and model you run, so results may be less polished than a large hosted model.
- How do I configure the LLM provider and API key?
- Configuration is normally done through the package's published config file plus environment variables for the provider, model name, base URL and API key. Keep the key in your .env file and never commit it, and use separate keys or models for development and production if you enable it in both. If requests fail, check the base URL and model name first, since those are the most common misconfiguration points.
- Is it safe to send production error data to an LLM API?
- Be careful, because stack traces can contain file paths, SQL fragments, request parameters and sometimes credentials or personal data. Safest options are a local model, enabling the package only in development or staging, or sanitising the payload before it leaves your server. Treat any external LLM call as data leaving your infrastructure and review it against your own compliance requirements.
- Does php-error-insight add overhead to my application?
- The package only does work when an error or exception is actually processed, so normal successful requests should not be affected. The slow part is the LLM call itself, which adds network or inference latency on top of the error handling path. Avoid running it synchronously on every exception in a high-traffic production app, and consider limiting it to debugging environments or dispatching it asynchronously.
- How do I disable error insight during automated tests?
- You do not want tests making real LLM calls, since that makes them slow, flaky and dependent on an external service. Most setups allow you to switch the driver off or set an enabled flag through an environment variable in your phpunit.xml. Check the package config for the available driver options and disable the feature in your testing environment.
- Can I customise the prompt or the format of the explanation?
- To some extent, yes: the package exposes configuration you can publish, and the prompt and output settings are typically adjustable there. If the default report format does not fit your workflow, reviewing the config is the first step before considering a fork. Since the project is small, extending a class or overriding a view is usually straightforward if the built-in options fall short.
- How is this different from Ignition, Whoops or Sentry?
- Ignition and Whoops focus on rendering readable error pages, while Sentry focuses on aggregating, alerting and tracking errors over time. php-error-insight adds a different layer: it asks an LLM to explain a specific error and suggest a fix in natural language. It complements those tools rather than replacing them, so keep your monitoring and your pretty error pages.