- How do I install spatie/flare-client-php in a Laravel project?
- Run `composer require spatie/flare-client-php` to install the client. For Laravel-specific integrations, use `spatie/laravel-flare` instead, which includes middleware and service provider setup. The client works standalone but requires manual configuration for error handling.
- What’s the difference between this package and spatie/laravel-flare?
- This package (`flare-client-php`) is a generic PHP client for Flare, while `laravel-flare` is a Laravel-specific wrapper with middleware, exception handlers, and deeper Laravel integrations. Use `laravel-flare` for Laravel apps; this client is for non-Laravel PHP projects or custom setups.
- Does this package support Laravel’s queue workers (e.g., dispatched jobs)?
- The package itself doesn’t integrate with Laravel queues, but you can run the `flare-daemon` (included as a dependency) as a Laravel queue worker or systemd service to capture errors from queued jobs. Ensure the daemon is active in the same environment where jobs execute.
- How does the flare-daemon improve error reporting reliability?
- The daemon buffers errors locally, retries failed API calls, and handles offline scenarios. It reduces network latency by batching requests and ensures errors aren’t lost during outages. However, it adds complexity by requiring a background process to manage.
- Can I use this package without the flare-daemon? What’s the trade-off?
- Yes, the daemon is optional. Without it, errors are sent directly to Flare’s API, which may fail silently or drop errors during network issues. The daemon improves resilience but adds setup overhead (e.g., storage, process management).
- What Laravel versions does spatie/flare-client-php support?
- The package itself doesn’t enforce Laravel version constraints, but it requires PHP 8.2+. For Laravel-specific features (like middleware), use `spatie/laravel-flare`, which supports Laravel 8.x–10.x. Test compatibility manually if using outside Laravel.
- How do I configure the daemon to store errors locally?
- The daemon uses the `storage_path()` directory by default (configurable via `.env`). Errors are stored as JSON files until synced to Flare. Monitor disk usage in high-error environments, as buffered errors consume space. Cleanup policies can be set via daemon configuration.
- What happens if Flare’s API is down for an extended period? Will errors be lost?
- Errors are buffered locally until the API is reachable. The daemon retries failed syncs, but if storage fills up or the daemon crashes, errors may be lost. Set up alerts for disk space or daemon failures to mitigate risks.
- Can I test the daemon’s error buffering in CI/CD?
- Yes, mock Flare’s API responses in tests (e.g., using HTTP clients like Guzzle) and verify local storage. The daemon provides CLI commands (e.g., `flare-daemon:list`) to inspect buffered errors. Simulate outages by blocking API calls during tests.
- Are there alternatives to spatie/flare-client-php for Laravel error monitoring?
- For Laravel, prioritize `spatie/laravel-flare` for seamless integration. Other alternatives include Sentry (with `spatie/laravel-sentry`), Bugsnag, or Rollbar. Choose based on features like real-time alerts, team collaboration, or customizable dashboards.