Installation
To install Ignition in your Laravel application, install it as a dependency via composer:
composer require facade/ignition
In Laravel 6.0 that command will move facade/ignition
from dev-dependencies
to dependencies
.
In Laravel 5.5, 5.6, 5.7 and older versions of 5.8 you will also need to modify your app/Exceptions/Handler.php
file to load Ignition instead of the default Whoops page. Make sure to remove filp/whoops
from your composer.json
to avoid conflicts.
Add this method to your Handler.php
file:
protected function whoopsHandler()
{
try {
return app(\Whoops\Handler\HandlerInterface::class);
} catch (\Illuminate\Contracts\Container\BindingResolutionException $e) {
return parent::whoopsHandler();
}
}
Optionally, you can publish configuration files.
php artisan vendor:publish --provider="Facade\Ignition\IgnitionServiceProvider" --tag="ignition-config"
This will publish config/ignition.php
.
php artisan vendor:publish --provider="Facade\Ignition\IgnitionServiceProvider" --tag="flare-config"
This will publish config/flare.php
.
Sending errors to Flare
If you want to send errors to Flare, you must specify a valid API key in the key
variable of the config file or as your FLARE_KEY
environment variable. You can get an API key when creating a new project or by visiting the project settings screen for an existing project.
The package uses Laravel's logging system to send errors. You must configure your log stack to use the flare
channel.
Here's an example where the flare
channel has been added.
// in config/logging.php
return [
'default' => env('LOG_CHANNEL', 'stack'),
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['daily', 'flare'],
'ignore_exceptions' => false,
],
],
];
To test out if the package is configured correctly to send error you can use the test command:
php artisan flare:test
If there's something wrong with your configuration, the message should guide you towards the solution.
Using Flare on Vapor
Laravel Vapor changes your default logging configuration to the stderr
channel, which is captured and logged by AWS CloudWatch.
You can add a new vapor
channel using the stack
driver that includes both the stderr
and flare
channels.
This is how it looks:
// in .env.production
LOG_CHANNEL=vapor
This is what it looks like:
// in config/logging.php
return [
'channels' => [
'vapor' => [
'driver' => 'stack',
'channels' => ['flare', 'stderr'],
'ignore_exceptions' => false,
],
'flare' => [
'driver' => 'flare',
],
],
];