spatie/laravel-flare
Send Laravel 11+ production errors to Flare for tracking, alerts, and shareable public reports. Configure with a Flare API key to capture exceptions automatically. Supports PHP 8.2+ and integrates cleanly alongside Laravel Ignition.
Observability-First Fit: spatie/laravel-flare is a first-class observability solution for Laravel, designed to integrate seamlessly with Flare, a SaaS-based error tracking and performance monitoring platform. It aligns perfectly with modern Laravel architectures (v11+) that prioritize distributed tracing, logging, and error monitoring as core observability pillars.
OpenTelemetry Alignment: The package leverages OpenTelemetry log format for logs and integrates with Flare’s distributed tracing capabilities, making it compatible with broader observability ecosystems (e.g., OpenTelemetry collectors, backends like Jaeger, or third-party APM tools).
Modular Design: The package follows Laravel’s service provider pattern, allowing for granular configuration (e.g., sampling, log levels, senders) without monolithic dependencies. Key components:
flare channel in config/logging.php for log forwarding.RateSampler, DynamicSampler for selective trace collection (e.g., by route, queue, or custom rules).LaravelHttpSender (default) and DaemonSender (for local Flare daemon routing).Laravel Ecosystem Synergy:
flare.collects config for domain-specific telemetry (e.g., payment gateways, third-party APIs).config/flare.php or .env. This reduces unintended overhead in production.UPGRADING.md).| Risk Area | Assessment | Mitigation |
|---|---|---|
| Performance Overhead | Logs/traces are sampled by default (configurable via RateSampler/DynamicSampler). Unoptimized setups (e.g., 100% sampling) may impact latency. |
Use selective sampling (e.g., DynamicSampler for critical routes only) and monitor flare:monitor command for bottlenecks. |
| Data Privacy/Security | Sensitive data (e.g., cookies, session, request bodies) is censored by default, but misconfiguration could expose PII. | Audit flare.php for censor rules and use environment-specific configs (e.g., config/flare-local.php for dev). |
| Flare API Dependencies | Network latency or Flare API downtime could block error reporting. The DaemonSender mitigates this but adds local infrastructure requirements. |
Prefer DaemonSender in production for offline resilience. Use fallback logging (e.g., single channel) if Flare is unavailable. |
| Breaking Changes | 3.0.x removed error-solutions and reportMessage() in favor of logging. Migration requires updating exception handlers and custom reporters. |
Follow UPGRADING.md and test in staging before rollout. Use feature flags to toggle Flare during transition. |
| Livewire/Octane Edge Cases | Livewire v4 and Octane support is recent (post-2.7.0). Edge cases (e.g., SFCs, async jobs) may require tuning. | Test with real-world workloads and monitor Flare’s Livewire traces for gaps. |
| Log Volume Explosion | Enabling logs at debug level could flood Flare with noise. |
Configure minimal_log_level (e.g., info) and use sampling to limit volume. |
RateSampler(10%).)reportMessage()) that need replacement?DaemonSender be used for offline resilience, or is LaravelHttpSender sufficient?App\Exceptions\Handler.flare channel to config/logging.php.AddFlareMiddleware for request/response telemetry.flare:test command for CI/CD error reporting.spatie/flare-daemon-php).flare.collects for domain-specific telemetry (e.g., Stripe, Twilio).| Phase | Action Items | Dependencies |
|---|---|---|
| Pre-Integration | 1. Audit Current Observability: Document existing error logging (e.g., Monolog, Sentry) and performance tools. | DevOps, SRE |
2. Flare Account Setup: Create Flare account, generate API key, and configure .env (FLARE_API_KEY). |
Security, Cloud Team | |
| 3. Stack Compatibility Check: Verify Laravel/PHP versions meet requirements (11.47+/12.42+/13+, PHP 8.2+). | Engineering | |
| Pilot Integration | 4. Install Package: composer require spatie/laravel-flare. |
How can I help you explore Laravel packages today?