PHPackages                             tylercd100/lern - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. tylercd100/lern

ActiveLaravel-package[Logging &amp; Monitoring](/categories/logging)

tylercd100/lern
===============

LERN (Laravel Exception Recorder and Notifier) is a Laravel 5 package that will record exceptions into a database and will notify you via Email, Pushover or Slack.

6.0.0(5y ago)438153.4k↓38.6%37[8 issues](https://github.com/tylercd100/lern/issues)[1 PRs](https://github.com/tylercd100/lern/pulls)3MITPHPPHP ^7.2|^8.0

Since Mar 21Pushed 4y ago12 watchersCompare

[ Source](https://github.com/tylercd100/lern)[ Packagist](https://packagist.org/packages/tylercd100/lern)[ Docs](https://github.com/tylercd100/lern)[ RSS](/packages/tylercd100-lern/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (70)Used By (3)

LERN (Laravel Exception Recorder and Notifier)
==============================================

[](#lern-laravel-exception-recorder-and-notifier)

[![Latest Version](https://camo.githubusercontent.com/ea8b30a70f11314aea32f28acc5ffb018276cccc37096e7bb8664652630a54cf/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f74796c657263643130302f6c65726e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/tylercd100/lern/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/d72152d257ba375eb1cfdb9b9cd648a55c2be4efa2a9ea740a5c14ce95cd9277/68747470733a2f2f7472617669732d63692e6f72672f74796c657263643130302f6c65726e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/tylercd100/lern)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/33d6ce7ad0ea55ab6eeae31e830f5e890f654884422bb44978da31ab266cf21b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f74796c657263643130302f6c65726e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/tylercd100/lern/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/757989dbc5959d61a3a6cd9ef8db7d2ac52c16dfe09c647156586f549ca6c3d9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f74796c657263643130302f6c65726e2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/tylercd100/lern/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/5a94b7d2519ffbcc28e5544a44fe17e512a889169d5b459394b263d4631ed106/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f74796c657263643130302f6c65726e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tylercd100/lern)

***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](https://github.com/Seldaek/monolog)

- Email
- [Pushover](https://pushover.net/)
- [Slack](https://slack.com/)
- [Fleephook](https://fleep.io/)
- [Flowdock](https://www.flowdock.com/)
- [Plivo](https://www.plivo.com/) an SMS messaging service.
- [Twilio](https://www.twilio.com/) an SMS messaging service.
- [Sentry](https://getsentry.com) via [Sentry SDK for PHP](https://github.com/getsentry/sentry-php)
- [Mailgun](https://mailgun.com)

Version Compatibility
---------------------

[](#version-compatibility)

LaravelLERN5.1.x3.x5.2.x3.x5.3.x3.x5.4.x3.x5.5.x4.x5.6.x4.x6.x5.x and 6.x7.x6.x8.x6.xMigrating from `3.x` to `4.x`
-----------------------------

[](#migrating-from-3x-to-4x)

Make sure that the config file now includes the new `lern.notify.class` and `lern.record.class` settings. Check the [config file](https://github.com/tylercd100/lern/blob/master/config/lern.php) to see how they are used.

Migrating from `2.x` to `3.x`
-----------------------------

[](#migrating-from-2x-to-3x)

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](https://github.com/tylercd100/lern/blob/master/config/lern.php), 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
```

Installation
------------

[](#installation)

Version 4.x uses [Package Discovery](https://laravel.com/docs/5.5/packages#package-discovery). If you are using 3.x you will need to follow these [instructions.](https://github.com/tylercd100/lern/tree/3.8.2)

Install via [composer](https://getcomposer.org/) - In the terminal:

```
composer require tylercd100/lern
```

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
```

Usage
-----

[](#usage)

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

```
public function report(Throwable $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

            /*
            OR...
            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;
use Throwable;
//or if you didnt...
use Tylercd100\LERN\Facades\LERN;
use Throwable;
```

### Recording

[](#recording)

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`

```
'record'=>[
    /**
     * The Model to use
     */
    'model' => \Tylercd100\LERN\Models\ExceptionModel::class,

    /**
     * Database connection to use. Null is the default connection.
     */
    'connection'=>null,

    /**
     * Database table to use
     */
    'table'=>'vendor_tylercd100_lern_exceptions',

    /**
     * Information to store
     */
	'collect'=>[
	    'method'=>false, //When true it will collect GET, POST, DELETE, PUT, etc...
	    'data'=>false, //When true it will collect Input data
	    'status_code'=>true,
	    'user_id'=>false,
	    'url'=>false,
        'ip'=>false,
	],
],
```

Note: If you change `lern.recorder.model` then `lern.recorder.table` and `lern.recorder.connection` will be ignored unless you extend `\Tylercd100\LERN\Models\ExceptionModel::class`

### Notifications

[](#notifications)

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 log level programmatically

[](#changing-the-log-level-programmatically)

Some notification services support different log levels. If changing the config value `lern.notify.log_level` is not enough then try it this way:

```
// Change the log level.
// Default is: critical
// Options are: debug, info, notice, warning, error, critical, alert, emergency
LERN::setLogLevel("emergency");
```

#### Changing the subject line

[](#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

[](#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

```
'notify'=>[
    'view'=>'exceptions.default',
],
```

##### (deprecated) Using the `LERN::setMessage()` function

[](#deprecated-using-the-lernsetmessage-function)

Make sure that you set the view config value to null or the `LERN::setMessage()` will not work

```
'notify'=>[
    'view'=>null,
],
```

#### Custom Monolog Handlers

[](#custom-monolog-handlers)

To use a custom Monolog Handler call the `pushHandler` method

```
use Monolog\Handler\SlackHandler;
$handler = new SlackHandler($token, $channel);
LERN::pushHandler($handler);
LERN::notify($exception);
```

Further Reading and How-Tos
---------------------------

[](#further-reading-and-how-tos)

- [Creating relationships between Exceptions and Users](https://github.com/tylercd100/lern/wiki/Creating-relationships-between-exceptions-and-users)

Roadmap
-------

[](#roadmap)

- Support more Monolog Handlers
- Exception report page or command to easily identify your application's issues.

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity51

Moderate usage in the ecosystem

Community30

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 92.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~32 days

Recently: every ~255 days

Total

55

Last Release

1992d ago

Major Versions

1.1.0 → 2.0.0-beta2016-03-23

2.3.0 → 3.0.02016-03-27

3.8.2 → 4.0.02017-08-31

4.5.1 → 5.0.02020-01-08

5.0.0 → 6.0.02020-12-03

PHP version history (7 changes)1.0.0PHP ^5.5|^7.0

2.0.0PHP ^5.4|^7.0

3.7.3PHP ^5.6|^7.0

3.8.2PHP ^5.5.9|^7.0

4.0.0PHP ^7.0

5.0.0PHP ^7.2

6.0.0PHP ^7.2|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5d0f17a08e8038aafdd451317206dda9429dfda2c7cbadb0c0796e25367108d5?d=identicon)[tylercd100](/maintainers/tylercd100)

---

Top Contributors

[![tylercd100](https://avatars.githubusercontent.com/u/4522226?v=4)](https://github.com/tylercd100 "tylercd100 (231 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (8 commits)")[![vincentmendiola](https://avatars.githubusercontent.com/u/5439242?v=4)](https://github.com/vincentmendiola "vincentmendiola (2 commits)")[![leamasuero](https://avatars.githubusercontent.com/u/3332647?v=4)](https://github.com/leamasuero "leamasuero (1 commits)")[![robbielove](https://avatars.githubusercontent.com/u/13571547?v=4)](https://github.com/robbielove "robbielove (1 commits)")[![fishisawesome](https://avatars.githubusercontent.com/u/6018584?v=4)](https://github.com/fishisawesome "fishisawesome (1 commits)")[![sroutier](https://avatars.githubusercontent.com/u/3011606?v=4)](https://github.com/sroutier "sroutier (1 commits)")[![tmdh](https://avatars.githubusercontent.com/u/18123729?v=4)](https://github.com/tmdh "tmdh (1 commits)")[![tortuetorche](https://avatars.githubusercontent.com/u/5038872?v=4)](https://github.com/tortuetorche "tortuetorche (1 commits)")[![smallhadroncollider](https://avatars.githubusercontent.com/u/477286?v=4)](https://github.com/smallhadroncollider "smallhadroncollider (1 commits)")[![fosron](https://avatars.githubusercontent.com/u/3708631?v=4)](https://github.com/fosron "fosron (1 commits)")[![iamlucianojr](https://avatars.githubusercontent.com/u/3333167?v=4)](https://github.com/iamlucianojr "iamlucianojr (1 commits)")

---

Tags

laravelslackexceptionsmonologtylercd100pushoverlern

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tylercd100-lern/health.svg)

```
[![Health](https://phpackages.com/badges/tylercd100-lern/health.svg)](https://phpackages.com/packages/tylercd100-lern)
```

###  Alternatives

[bugsnag/bugsnag-laravel

Official Bugsnag notifier for Laravel applications.

90334.6M36](/packages/bugsnag-bugsnag-laravel)[tylercd100/laravel-notify

12152.1k1](/packages/tylercd100-laravel-notify)[guanguans/laravel-exception-notify

Monitor exception and report to the notification channels(Log、Mail、AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

14642.7k1](/packages/guanguans-laravel-exception-notify)[naoray/laravel-github-monolog

Log driver to store logs as github issues

10619.4k](/packages/naoray-laravel-github-monolog)[shaffe/laravel-mail-log-channel

A package to support logging via email in Laravel

1286.2k](/packages/shaffe-laravel-mail-log-channel)[yzen.dev/mono-processor

This Processor will display in the logs bread crumbs by which you can more quickly and accurately identify the cause of the error.

116.1k](/packages/yzendev-mono-processor)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
