Skip to content
Laravel service provider for Airbrake
Branch: master
Clone or download
Latest commit 7dde5a7 Oct 23, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
config Add new options and remove redundant code Feb 6, 2018
src Fix namespace issue Mar 8, 2018
.gitignore Add new options and remove redundant code Feb 6, 2018
LICENSE Initial commit Mar 12, 2016 Update Oct 23, 2018
composer.json Fix namespace issue Mar 7, 2018

Laravel Airbrake

This is a Laravel service provider for the latest Airbrake PHP package

The service provider will configure an instance of Airbrake\Notifier with an ID, key and environment name.


Require via composer.

composer require kouz/laravel-airbrake

For Laravel >=5.5 the package will be discoverd. For Laravel <=5.4 add package to list of service providers in config/app.php


    'providers' => [

Publish and fill out the config/airbrake.php file with your ID and key.

php artisan vendor:publish --provider="Kouz\LaravelAirbrake\ServiceProvider"


The variables projectId and projectKey are required. Leave the rest empty to use Airbrake's default values.

    'projectId'     => '',
    'projectKey'    => '',
    'environment'   => env('APP_ENV', 'production'),

    //leave the following options empty to use defaults

    'appVersion'    => '',
    'host'          => '',
    'rootDirectory' => '',
    'httpClient'    => '',

Basic Usage

>=5.6 Custom Channel

Add the custom "airbrake" channel (outlined below) to config/logging.php. Then add the "airbrake" channel to the stack channel.


    'channels' => [
        'stack' => [
            'driver' => 'stack',
            'channels' => ['single', 'airbrake'],

        'airbrake' => [
            'driver' => 'custom',
            'via' => Kouz\LaravelAirbrake\AirbrakeLogger::class,
            'level' => 'error',

Exception Handler

To notify airbrake through the laravel exception handler as shown in the following code snippet. Inject or make a new instance of a Airbrake\Notifier object then pass a exception to the notify function.


 * Report or log an exception.
 * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
 * @param  \Exception  $exception
 * @return void
public function report(Exception $exception)
    if ($this->shouldReport($exception)) {
        $airbrakeNotifier = \App::make('Airbrake\Notifier');


<=5.5 Custom Monolog Configuration

To configure it as a Monolog handler you will have to create a custom configuration in bootstrap/app.php. This callback function is called before the service providers are loaded. So it is necessary to directly use our AirbrakeHandler class instead of the provider.


$app->configureMonologUsing(function($monolog) use ($app) {
    $airbrakeNotifier = (new Kouz\LaravelAirbrake\AirbrakeHandler($app))->handle();
    $monologHandler = new Airbrake\MonologHandler($airbrakeNotifier, Monolog\Logger::ERROR);
You can’t perform that action at this time.