spatie/flare-client-php
PHP 8.2+ client for sending exceptions, errors, and stack traces to Flare. Install via Composer and use in any PHP app; Laravel users should use spatie/laravel-flare. Includes docs, tests, and ongoing maintenance by Spatie.
error_log()) or third-party tools like Sentry/New Relic. Aligns with a shift toward developer productivity and SRE practices in PHP stacks.Monolog for structured logs (OpenTelemetry format) with dynamic sampling (e.g., sample 100% of checkout flows, 0% of health checks).Adopt if:
error_log()) or Sentry but want a PHP-native solution with better trace context.Look elsewhere if:
Sentry CLI or Laravel Telescope for lightweight needs).*"Flare is a force multiplier for our PHP dev teams. Today, debugging production errors is a time sink—devs chase logs, parse stacktraces, and guess context. With Flare, we’ll:
- Cut MTTR for critical bugs by 50%: Errors arrive with full request context (headers, DB queries, traces), so devs resolve issues faster.
- Reduce support costs: Flare’s AI-assisted solutions (e.g., ‘Try adding
->strict()to this query’) let junior devs fix common issues without escalating.- Unify observability: Replace fragmented tools (Sentry for errors, Datadog for traces, custom logs) with a single pane of glass—no more context-switching.
- Future-proof our stack: Flare’s OpenTelemetry compatibility ensures we’re ready for distributed tracing as we scale.
Cost: ~$500/month (team plan) for enterprise-grade debugging—far cheaper than lost dev hours. ROI: 3–6 months via reduced outages and faster releases."*
*"This is the missing piece for PHP observability. Here’s why we should adopt
spatie/flare-client-php:1. Modern Error Tracking
- Replaces
try/catch+error_log()with structured error reports (stacktraces, variables, HTTP context).- Dynamic sampling: Log everything in staging, but sample intelligently in prod (e.g., 100% for
/checkout, 0% for/health).2. Distributed Tracing for PHP
- Trace HTTP requests, queue jobs, and CLI commands as subtasks (no more ‘lost’ async workflows).
- W3C Trace Context: Works with OpenTelemetry if we adopt it later.
3. Developer Experience
- No code changes for basic usage (auto-captures errors/exceptions).
- Self-service debugging: Devs can replay requests, inspect traces, and see suggested fixes—no more ‘it works on my machine’ emails.
- Git-aware: Errors show which commit/branch caused them (critical for CI/CD).
4. Security & Compliance
- Automatic PII redaction: Censors cookies, sessions, and custom fields (e.g.,
user.password).- No data leakage: Errors are encrypted in transit and stored securely.
5. Lightweight Integration
- 5-minute setup: Drop into Laravel/Symfony or vanilla PHP. Zero runtime overhead in happy paths.
- Fallbacks: Uses a local daemon (no external deps) with HTTP fallback.
Alternatives:
- Sentry: Better for JS, but PHP support is clunky. Flare is PHP-native with superior trace context.
- Laravel Telescope: Great for local dev, but not production-grade (no sampling, limited traces).
- DIY: Building this would take 3+ dev-weeks; Flare is battle-tested by 10K+ apps.
Next Steps:
- Pilot: Install in staging for 2 critical services (e.g., payments, auth).
- Train team: 1-hour session on Flare’s UI (filtering, replaying requests).
- Roll out: Gradually enable in prod, starting with high-severity errors.
Risk: Minimal—Flare is opt-in and non-blocking. We can disable it if needed."*
How can I help you explore Laravel packages today?