facade/flare-client-php
PHP client for Flare error reporting and monitoring. Captures exceptions in Laravel/PHP apps, enriches with context, and sends them to Flare for grouping, analysis, and alerts. Configurable transport, stack traces, and metadata support.
App\Exceptions\Handler) with granular control over error reporting, now including environment-aware filtering.report filtering feature (PR #33) enables selective error reporting via:
DeprecationNotice in production).app()->environment('staging')).Flare::filter(fn($e) => $e->getCode() === 500))..env and config/ patterns, reducing friction..env variables (e.g., FLARE_FILTER_ENV) and programmatic setup, adhering to Laravel’s 12-factor principles.php -v and pin to ^8.1 if needed.throw_if() or report() methods.guzzlehttp/guzzle:^6.5 in composer.json.App\Exceptions\Handler.throw_if vs. report())?severity: critical AND environment: production)?App\Exceptions\Handler::report() with filtering:
public function report(Throwable $e) {
if (Flare::shouldReport($e)) { // Uses new filtering logic
Flare::report($e);
}
parent::report($e);
}
Flare::filter(fn($e) => !request()->is('api/*'));
Flare::filter(fn($e) => Log::getLevel() !== 'debug');
Flare::filter() before Flare::report() for standalone PHP apps.1.10.0 and configure .env:
FLARE_FILTER_ENV=production
FLARE_FILTER_TYPES=Symfony\Component\HttpKernel\Exception\HttpException
Flare::report(new \Exception('Test')); // Verify exclusion rules
report() with filtering (see above).config/flare.php:
'filters' => [
'production' => ['severity' => 'critical', 'except' => ['DeprecationNotice']],
'staging' => ['only' => ['\RuntimeException']],
],
DeprecationNotice in production).tideways-xhprof or Laravel Debugbar.composer.json:
"require": {
"php": "^8.1",
"facade/flare-client-php": "^1.10.0",
"guzzlehttp/guzzle": "^6.5"
}
Flare::extendFilter()).facade/flare-client-php:^1.10.0 and Guzzle to avoid auto-updates..env keys (e.g., AWS Secrets Manager).config/flare.php for environment-specific filters:
'filters' => [
'production' => [
'severity' => ['critical', 'error'],
'except' => ['Symfony\Component\Debug\Exception\FatalErrorException'],
],
],
severity: critical).Flare::debugFilters() to log active rules.Flare::debugFilters(); // Outputs applied filter rules
Flare::filter(fn($e) => rand(1, 100) <= 10); // 10% sampling
| Scenario | Impact | Mitigation |
|---|---|---|
| Flare API downtime |
How can I help you explore Laravel packages today?