Flare Error tracking made for Laravel
Features Pricing Docs Blog Log in Start free trial Free trial
  • Docs
  • Videos

Documentation

  • General

    • Welcome
    • Projects
    • Errors
    • Error occurrences
    • Using the API
    • Sharing error occurrences
    • Spike protection
    • GitHub integration
  • Ignition for Laravel

    • Installation
    • Configuration
    • Security
    • Controlling collected data
    • Sending logs to Flare
    • Linking to errors
    • Identifying users
    • Adding custom context
    • Adding glows
    • Writing custom middleware
  • Flare for generic PHP projects

    • Installation
    • Controlling collected data
    • Identifying users
    • Linking to errors
    • Adding custom context
    • Adding glows
    • Writing custom middleware
  • Javascript error tracking

    • Installation
    • Framework integrations
    • Resolving Bundled Code
    • Reporting errors
    • Client hooks
    • Adding custom context
    • Adding glows
    • Solution Providers
  • Solutions

    • Introduction
    • Adding custom solutions
    • Making solutions runnable
    • Using solution providers
    • Writing good solutions
  • Notifications

    • Configuring notifications
    • Mail
    • Slack
    • Telegram
    • SMS
    • Webhooks
    • Discord
    • Microsoft Teams
  • Team management

    • Using multiple teams
    • Subscribing to a plan
    • Receiving invoices
    • Managing team members
    • Inviting guests to projects

Installation

In Laravel 9

Laravel 9 ships with Ignition by default. When an error is thrown in a web request, you'll automatically see our beautiful error page.

Optionally, you can publish configuration files.

config/ignition.php:

php artisan vendor:publish --provider="Spatie\LaravelIgnition\IgnitionServiceProvider" --tag="ignition-config"

config/flare.php:

php artisan vendor:publish --provider="Spatie\LaravelIgnition\IgnitionServiceProvider" --tag="flare-config"

Continue reading below to learn how to send errors to Flare.

In Laravel 8

Laravel 8 ships with facade/ignition by default, which is the old version of Ignition.

To upgrade to the newest version, replace the facade/ignition dependency in your composer.json file with spatie/laravel-ignition:^1.0. The resulting composer.json file should look something like this:

{
    "require": {
        "spatie/laravel-ignition": "^1.0"
    }
}

Continue reading below to learn how to send errors to Flare.

In Laravel 7 and below

To install Ignition in Laravel 7 (and below application), install it as a dependency via composer:

composer require facade/ignition

In Laravel 6.0 and above 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

Ignition has a built-in client to send errors to Flare. To send errors to Flare, you must move the dev-dependency of Ignition to the regular dependencies, so that the package is also installed in your production environment. Don't worry, Ignition will never render an error page in a production environment. You can ensure that Ignition is installed as a regular dependency by running the following command:

composer require spatie/laravel-ignition

To authenticate, you must specify a valid API key in the key variable of the config file or as a 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.

Finally, Ignition uses Laravel's logging system to catch and send errors. You must configure your log stack to use the flare driver. Update the config/logging.php file to add and use a new flare channel:

// in config/logging.php

return [
   'default' => env('LOG_CHANNEL', 'stack'),

   'channels' => [
       'stack' => [
           'driver' => 'stack',
           'channels' => ['daily', 'flare'],
           'ignore_exceptions' => false,
       ],
       'flare' => [
           'driver' => 'flare',
       ],
    ],
];

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',
        ],
    ],
];
Previous topic Next topic

On this page

  • In Laravel 9
  • In Laravel 8
  • In Laravel 7 and below
  • Sending errors to Flare
  • Using Flare on Vapor

About Flare

  • Home
  • Features
  • Pricing
  • Support

Resources

  • Blog
  • Changelog
  • Docs
  • Ignition

App

  • Log in
  • Start free trial
SPATIE
  • Service status
  • Terms of use
  • Privacy & cookie policy