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.
spatie/flare-client-php package is a first-class observability tool for Laravel/PHP applications, designed to integrate seamlessly with Flare (Spatie’s error monitoring and debugging platform). It aligns perfectly with modern distributed tracing, structured logging, and error tracking needs, making it ideal for teams prioritizing SRE/DevOps-driven observability.Tracer, BackTracer)Logger, LogLevel enum)DynamicSampler, SamplingRule)RequestAttributesProvider, JobAttributesProvider)Lifecycle for flushing/resets)JobRecorder, QueueRecorder)
This modularity allows granular customization without monolithic dependencies.artisan command handling, queue job recording) via the laravel-flare package, reducing boilerplate for Laravel apps.Flare::create(). This allows:
HandleFlareRequests) or exception handlers, with minimal impact on existing workflows.error-solutions removed in v3.0).| Risk Area | Assessment | Mitigation Strategy |
|---|---|---|
| Performance Overhead | Tracing/logging adds ~5-15ms per request (varies by sampling rate). In high-traffic APIs, this could impact latency if not optimized. | - Use dynamic sampling (DynamicSampler) to throttle non-critical paths (e.g., health checks at 0% sampling).- Leverage Flare daemon for batching/async sends. |
| Complexity Spike | Advanced features (e.g., attribute providers, subtask mode) require custom implementations for full value. | - Start with default configurations and iteratively add providers (e.g., RequestAttributesProvider).- Use Flare’s UI to debug misconfigurations. |
| Vendor Lock-in | Flare-specific formats (e.g., traceparent, attribute providers) may limit portability to other APM tools. | - Abstract Flare-specific logic behind interfaces (e.g., TracerInterface) for easier swapping.- Export traces in OpenTelemetry format for multi-tool compatibility. |
| Data Privacy | Sensitive data (e.g., cookies, session data) may leak if not censored properly. | - Use built-in censoring (e.g., censorCookies(), censorBodyFields()).- Implement custom attribute providers to filter PII. |
| Migration Cost | Upgrading from v1/v2 to v3.x requires breaking changes (e.g., Flare properties → methods, removed error-solutions). |
- Follow the UPGRADING.md guide.- Use feature flags to test v3.x alongside v2.x during transition. |
| Flare Daemon Dependency | Local daemon introduces infrastructure complexity (e.g., Docker setup, port conflicts). | - Use HTTP fallback for simplicity.- Containerize the daemon for CI/CD environments. |
100% for checkout flows, 0% for health checks)? Will custom samplers be required?| Component | Compatibility | Notes |
|---|---|---|
| PHP | 8.2+ (required). Tested up to PHP 8.5. | Avoid PHP 8.1 or lower due to deprecation warnings. |
| Laravel | 10+ (officially supported). Laravel 11/12/13 tested via laravel-flare. |
Use spatie/laravel-flare for zero-config Laravel integrations. |
| Symfony | 6.4+ (via symfony/http-client). |
Works with Symfony 8 (tested in v2.5.3). |
| Queues | Supports Laravel Queues, Symfony Messenger, and custom queue workers. | Uses JobRecorder and QueueRecorder for subtask mode (jobs as traces within parent requests). |
| Testing Frameworks | Pest, PHPUnit. | Supports flare:test command for capturing test failures. |
| Observability Tools | OpenTelemetry (via W3C TraceContext), Jaeger, Zipkin (via export). | Can export traces to OTLP endpoints for multi-tool ecosystems. |
| Infrastructure | Docker (for Flare daemon), Kubernetes (sidecar for daemon). | Daemon can run as a local service or sidecar container. |
spatie/flare-client-php in a non-production environment.500 responses).How can I help you explore Laravel packages today?