LERN is a Laravel 5 package that will record exceptions into a database and will notify you via Email, Pushover or Slack.
Latest commit 7a1192d Nov 29, 2016 @tylercd100 - Updated to tylercd100/laravel-notify@^1.8.5 which sets the content …
…type of SMTP emails to text/html instead of text/plain


LERN (Laravel Exception Recorder and Notifier)

Latest Version Software License Build Status Scrutinizer Code Quality Code Coverage Dependency Status Total Downloads

LERN from your mistakes

LERN is a Laravel 5 package that will record exceptions into a database and will send you a notification.

Currently supported notification channels via Monolog

Migrating from 2.x to 3.x

Version 3.x introduces the ability to collect more information from the error such as the user_id, url, method, and input data. In order to use 3.x you will need to copy over the new config file, the migration file and then migrate it.

# This will only copy over the migration file. For the config file you can either include the --force flag (Which will overwrite it) or copy it manually from github 
php artisan vendor:publish --provider="Tylercd100\LERN\LERNServiceProvider"
php artisan migrate


Install via composer - In the terminal:

composer require tylercd100/lern

Now add the following to the providers array in your config/app.php


and this to the aliases array in config/app.php

"LERN" => Tylercd100\LERN\Facades\LERN::class,

Then you will need to run these commands in the terminal in order to copy the config and migration files

php artisan vendor:publish --provider="Tylercd100\LERN\LERNServiceProvider"

Before you run the migration you may want to take a look at config/lern.php and change the table property to a table name that you would like to use. After that run the migration

php artisan migrate


To use LERN modify the report method in the app/Exceptions/Handler.php file

public function report(Exception $e)
    if ($this->shouldReport($e)) {

        //Check to see if LERN is installed otherwise you will not get an exception.
        if (app()->bound("lern")) {
            app()->make("lern")->handle($e); //Record and Notify the Exception

            app()->make("lern")->record($e); //Record the Exception to the database
            app()->make("lern")->notify($e); //Notify the Exception

    return parent::report($e);

Dont forget to add this to the top of the file

//If you updated your aliases array in "config/app.php"
use LERN;
//or if you didnt...
use Tylercd100\LERN\Facades\LERN;


You can call LERN::record($exception); to record an Exception to the database. To query any Exception that has been recorded you can use ExceptionModel which is an Eloquent Model

use Tylercd100\LERN\Models\ExceptionModel;
$mostRecentException = ExceptionModel::orderBy('created_at','DESC')->first();

To change what is recorded in to the database take a look at config/lern.php

        'method'=>false, //When true it will collect GET, POST, DELETE, PUT, etc...
        'data'=>false, //When true it will collect Input data


LERN uses the Monolog library to send notifications. If you need more than the supported notification channels, then you can add your own custom Monolog handlers. To start using any of the supported handlers just edit the provided config file config/lern.php.

Changing the subject line

Some notification services support a subject line, this is how you change it.

//Change the subject
LERN::setSubject("An Exception was thrown!");

Changing the body of the notification

LERN publishes a default blade template file that you can find at resources/views/exceptions/default.blade.php. The blade template file is compiled with these values: $exception $url $method $data $user. To specify a different blade template file, just edit the config file


Custom Monolog Handlers

To use a custom Monolog Handler call the pushHandler method

use Monolog\Handler\HipChatHandler;
$handler = new HipChatHandler($token,$room);

Further Reading and How-Tos


  • Support more Monolog Handlers
  • Exception report page or command to easily identify your application's issues.
  • Notification rate limiting and/or grouping.