spatie/flare-client-php
PHP client for sending errors, exceptions, and stack traces to Flare. Install via Composer, configure your API key, and report incidents from any PHP 8.2+ app. For Laravel integrations, use spatie/laravel-flare.
laravel-flare), making it ideal for non-Laravel PHP apps (Symfony, Lumen, custom SAPI scripts) or Laravel microservices where the dedicated package isn’t needed.laravel-flare for deeper integration (e.g., Ignition compatibility).E_NOTICE) and report filtering reduce noise in production.| Risk Area | Mitigation Strategy |
|---|---|
| API Dependency | Flare’s API is stable (used by 100K+ apps), but graceful fallback handles outages. |
| Sensitive Data Leaks | Built-in censoring for cookies, sessions, and request bodies (wildcard syntax). |
| Performance Impact | Minimal overhead; batched requests and async-friendly design. |
| Version Skew | SemVer compliance and backward-compatible changes (e.g., PHP 8.5 fixes). |
| Laravel-Specific Quirks | Avoids Laravel’s artisan/please in stack traces by default (configurable). |
laravel-flare for Ignition integration, or is this package sufficient for error reporting alone?laravel-flare is overkill.laravel-flare for Ignition integration (this package handles raw error reporting).HttpFoundation and Console components.reportErrorLevels = E_ALL & ~E_NOTICE to test coverage.password fields in requests)./health errors).E_ERROR levels).monolog-handler-flare).| Component | Compatibility Notes |
|---|---|
| PHP Versions | 8.2+ (PHP 8.5 deprecation warnings fixed). |
| Frameworks | Laravel (non-Ignition), Symfony, Lumen, custom SAPI, CLI scripts. |
| Dependencies | No hard dependencies beyond PHP core (uses guzzlehttp/psr7 for HTTP). |
| Flare API | Supports self-hosted instances via custom API URLs. |
| Database | No direct DB access; collects Git info and environment variables locally. |
composer require spatie/flare-client-php..env:
FLARE_API_KEY=your_key
FLARE_APP_NAME=YourApp
FLARE_APP_ENV=production
set_error_handler/set_exception_handler:
Flare::registerErrorHandler();
Flare::registerExceptionHandler();
Flare::addAttributeProvider(function () {
return ['db_queries' => DB::getQueryLog()];
});
Flare::censorCookies(['session']);
Flare::censorRequestBody('*.password');
flare:test command to verify error reporting:
php artisan flare:test
guzzlehttp/psr7 and PHP core dependencies.FLARE_API_KEY).flare:test command simplifies debugging.FLARE_BATCH_SIZE).| Failure Scenario | Mitigation Strategy |
|---|---|
| Flare API Outage | Errors are queued locally and retried |
How can I help you explore Laravel packages today?