Installation
You can install the Flare client as follows:
composer require spatie/flare-client-php:^2.0
Next, initialise the client in your project:
use Spatie\FlareClient\Flare;
$flare = Flare::make('YOUR-API-KEY')->registerFlareHandlers();
Great! From now on, Flare will track all errors and exceptions throughout your application.
Configuring Flare
It is possible to configure the Flare client to suit your needs. You can do this by creating a Flare config object:
use Spatie\FlareClient\FlareConfig;
$config = FlareConfig::make('YOUR-API-KEY');
$flare = Flare::make($config)->registerFlareHandlers();
In the next pages we will discuss the different configuration options available to you, methods you can call on the config object will always be using the $config
variable, methods that should be called on the Flare object will be using the $flare
variable.
Setting the application root path
We recommend that you set the application root path. This will help Flare determine the correct file paths in your stack traces.
$config->applicationPath('/path/to/your/application/root');
- On this page
- Configuring Flare
- Setting the application root path