Installation
Ignoring errors
The Flare client will always send all exceptions to Flare, you can change this behaviour by filtering the exceptions with a callable:
// Where you registered your client...
$flare = Flare::make('YOUR-FLARE-API-KEY')
->registerFlareHandlers();
$flare->filterExceptionsUsing(
fn(Throwable $throwable) => !$throwable instanceof AuthorizationException
);
Additionally, you can provide a callable to the Flare::filterReportsUsing
method to stop a report from being sent to Flare. Compared to filterExceptionsCallable
, this can also prevent logs and errors from being sent.
use Spatie\FlareClient\Flare;
$flare = Flare::make('YOUR-API-KEY')
->registerFlareHandlers();
Flare::filterReportsUsing(function(Report $report) {
// return a boolean to control whether the report should be sent to Flare
return true;
});
Finally, it is also possible to set the levels of errors reported to Flare as such:
$flare->reportErrorLevels(E_ALL & ~E_NOTICE); // Will send all errors except E_NOTICE errors