Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Flare Client Php

Flare Client Php Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Send PHP errors to Flare

Frequently asked questions about Flare Client Php
How do I install spatie/flare-client-php in a Laravel project?
Run `composer require spatie/flare-client-php` to install the package. For Laravel-specific integrations, use `spatie/laravel-flare` instead, which simplifies setup with middleware and exception handling. The client works standalone for non-Laravel PHP apps.
Does this package support OpenTelemetry for cross-tool compatibility?
Yes, the package aligns with OpenTelemetry standards, including W3C TraceContext and log formats. You can export traces to tools like Jaeger or Zipkin while still sending data to Flare. Check the [docs](https://flareapp.io/docs/php/general/introduction) for configuration details.
What Laravel versions does spatie/flare-client-php support?
The package officially supports Laravel 10+ and PHP 8.2+. For older Laravel versions (9.x), use `spatie/laravel-flare` v2.x, which includes backward compatibility. Always check the [UPGRADING.md](https://github.com/spatie/flare-client-php/blob/main/UPGRADING.md) guide for breaking changes.
How do I configure dynamic sampling to reduce overhead?
Use the `DynamicSampler` class to define rules for sampling traces. For example, sample 100% of requests to `/checkout` but 0% for `/health`. Configure it via `Flare::create()->withSampler(new DynamicSampler([...]))`. This reduces performance impact in high-traffic apps.
Can I use this package without the Flare daemon (HTTP-only mode)?
Yes, the package defaults to using a local Flare daemon for performance but falls back to HTTP if the daemon is unavailable. For simplicity, configure it via `Flare::create()->withoutDaemon()` or rely on the HTTP endpoint in `config/flare.php`.
How do I censor sensitive data like cookies or API keys in logs?
Use built-in censoring methods like `censorCookies()` or `censorBodyFields()`. For custom data, implement a `AttributeProvider` and override the `censor()` method. Example: `Flare::create()->withAttributeProvider(new CustomProvider())->censorBodyFields(['password'])`.
What’s the performance impact of using this package in production?
The package adds ~5–15ms per request, depending on sampling rates and daemon usage. Mitigate overhead by sampling non-critical paths (e.g., health checks at 0%) and using the daemon for batching. Benchmark in staging to align with your SLA requirements.
How do I test this package in CI/CD without a Flare daemon?
Mock the `Flare` client in tests by injecting a custom `TracerInterface` or `LoggerInterface`. Use PHPUnit’s `partialMock` to stub methods like `sendTrace()`. Example: `$flare = $this->partialMock(Flare::class, ['sendTrace']); $flare->expects($this->once())->method('sendTrace')->with(...).
Are there alternatives to spatie/flare-client-php for Laravel error tracking?
Yes, alternatives include Sentry (via `sentry/sentry-laravel`), Laravel Debugbar, or Ray (by Spatie). Sentry offers broader APM features but with more complexity, while Debugbar is lightweight for local debugging. Flare excels in production observability with its daemon-first approach and Laravel-native integrations.
How do I upgrade from spatie/flare-client-php v2 to v3?
Follow the [UPGRADING.md](https://github.com/spatie/flare-client-php/blob/main/UPGRADING.md) guide, which details breaking changes like replacing `Flare::properties()` with methods. Test in a staging environment first, especially if using custom attribute providers or sampling logic. Use feature flags to run v3 alongside v2 during migration.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony