- What is spatie/flare-debug-sender used for in Laravel applications?
- This package lets you send and debug Flare payloads locally, simulating error reports without relying on external services. It’s perfect for testing how errors appear in Flare during development or staging, ensuring accurate debugging before they reach production.
- Do I need Flare installed before using this package?
- Yes, this package is designed to work with Spatie’s Flare (spatie/laravel-flare). If you don’t already use Flare for error tracking, you’ll need to install it first, as this package only sends debug payloads compatible with Flare’s format.
- How do I install spatie/flare-debug-sender in Laravel?
- Run `composer require spatie/flare-debug-sender`, then publish Flare’s config file with `php artisan vendor:publish --tag=flare-config`. Update the `flare.php` config to use `FlareDebugSender` under the `sender` key, and configure your preferred debug channel (e.g., Laravel logs).
- Can I send debug payloads via HTTP to a local endpoint?
- Yes, the package supports HTTP-based debugging. Configure the `sender` in `flare.php` to use `CurlSender` and set the `curl_options` to point to your local endpoint (e.g., `http://localhost:8000/debug-flare`). Ensure SSL verification is disabled for local testing if needed.
- Is this package compatible with Laravel 10+?
- Yes, spatie/flare-debug-sender works with Laravel 10 and later, as it depends on Flare’s compatibility. Always check the latest Flare version for Laravel-specific requirements, but this package itself has no framework version restrictions beyond Flare’s support.
- How do I trigger debug payloads in my Laravel tests?
- Manually trigger payloads by calling `Flare::send()` in your tests or by throwing exceptions that Flare catches. For automated testing, configure Flare to capture specific exceptions in `config/flare.php` under `ignored_exceptions` or use the `FlareDebugSender` to log payloads to a channel like `LaravelLogDebugChannel` for inspection.
- Will this package slow down my local development?
- Minimal impact if configured properly. Use asynchronous channels (e.g., queues) to avoid blocking requests. Disable debug payloads in production by setting `passthrough_errors` to `false` in the config, and ensure debug endpoints are restricted to local/staging environments only.
- Are there alternatives to this package for debugging Flare errors?
- If you’re not using Flare, consider Laravel Telescope for query/debug inspection or Ray for real-time request debugging. For Flare-specific needs, this package is the official debug sender, but you could also mock Flare payloads manually in tests without this package if your use case is simple.
- How do I secure debug payloads sent via HTTP?
- Restrict access to your debug endpoint using Laravel middleware (e.g., `throttle`, `ip`, or `auth`). For local testing, use environment-specific routes (e.g., `DEBUG_FLARE_ENDPOINT` in `.env`) and disable the endpoint in production. Avoid hardcoding sensitive URLs in config files.
- Can I use this package in staging environments?
- Yes, but ensure debug payloads aren’t accidentally sent to production. Use environment variables to toggle the debug sender (e.g., `if (app()->environment('staging'))`) and validate that your staging Flare config mirrors production settings except for the debug sender configuration.