Skip to content
Laravel Self Hosted Tiny Error Tracking System With Notifications
PHP Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config Add ability to set URL prefix to view lapse pages Aug 14, 2018
database/migrations Flexible notifcation Jul 22, 2018
resources
routes 🐣 version 2 born Jul 21, 2018
src Merge branch 'master' of https://github.com/pyaesone17/lapse Aug 17, 2018
.gitattributes Create .gitattributes Jul 30, 2018
.gitignore Fix it Oct 13, 2017
LICENSE
LICENSE.md Fix it Oct 13, 2017
README.md Adding way to request new feature Sep 12, 2018
composer.json gg Oct 13, 2017
composer.lock Support console Jul 23, 2018
lapse.png Fix it Oct 13, 2017
lapse_v2.0.8.1.png Update dashboard screen for version 2.0.8 Aug 17, 2018
lapse_v2.png Update dashboard screen for version 2.0.8 Aug 17, 2018
sync.sh 🐣 version 2 born Jul 21, 2018

README.md

Example

Introducing

Lapse provides a beautiful dashboard to track your errors in production without having to look up log file. Moreover it can notify you via Slack channel and Email alert. And moreover it can notify you via all of the channels from http://laravel-notification-channels.com/.

Lapse behind the scence depend on https://laravel.com/docs/5.6/notifications. It means theoretically Lapses can notify your error via over 30 ways including Slack, Email, Nexmo, Trello, Telegram, Facebook, Discord, Pusher, Twillo, Twitte. But I haven't test agaisnt all of the channels, If you find a bug, please submit an issue. If you want to know more, please kindly check the link.

For old version please see documentation at https://github.com/pyaesone17/lapse/tree/v1

Upgrade Guide

If you are upgrading from version 1.

Please delete config/lapse.php file first.

Install

Install Via Composer

$ composer require pyaesone17/lapse

Publish vendor

$ php artisan vendor:publish

Add slack hook url in config/lapse.php and define channels ( https://api.slack.com/incoming-webhooks )

    'channels' => [
        'slack' => 'https://hooks.slack.com/services/......',
        'mail' => 'your@mail.com'
    ],
    // Currently two notification channels supported
    // Those are slack and email
    // But you can use all of the notifications from http://laravel-notification-channels.com/
    // See the custom channel of my read me file to explore how to integrate
    'via' => ['slack']
$ php artisan vendor:publish

Migrate lapses table

php artisan migrate

Usage

after that register In the report method of App\Exceptions\Handler like this.


    use Pyaesone17\Lapse\ErrorNotifiable;
    ..
    
    class Handler extends ExceptionHandler
    {
        use ErrorNotifiable;
        ...
    
        public function report(Exception $exception)
        {
            if( app()->environment()!='local' ){ // Remove this line if you want lapse to notify in local environment
                $this->sendNotification($exception);
            }
        }
        ...  
    }

Laravel Lapse's dashboard is inspired by Laravel Horizon. Just like Horizon you can configure authentication to Lapse's dashboard. Add the following to the boot method of your AppServiceProvider. Here you could also check role permision and limit the dasboard.

    \Pyaesone17\Lapse\Lapse::auth(function($request) {
        // return true / false . For e.g.
        return \Auth::check();
    });

To view the dashboard point your browser to /lapse of your app. For e.g. laravel.dev/lapse. But the app is in local environment, lapse will not even attend to validate auth, It will display it all.

To delete all lapse message via cli , please run

$ php artisan clear:lapse

Custom Notification Channel

you can use all notifications from http://laravel-notification-channels.com/ to integrate with lapse

For example, Telegram

install channel via composer

    $ composer require laravel-notification-channels/telegram

configure the config/lapse.php first

    use NotificationChannels\Telegram\TelegramChannel;
    'channels' => [
        'slack' => 'https://hooks.slack.com/services/......',
        'telegram' => 'tele_gram_user_id', //optional
    ],
    // Currently two notification channels is supported built in
    // Those are slack and email
    'via' => ['slack', TelegramChannel::class]

register telegram provider

// config/app.php
'providers' => [
    ...
    NotificationChannels\Telegram\TelegramServiceProvider::class,
],

Set credentials

    // config/services.php
    'telegram-bot-api' => [
        'token' => env('TELEGRAM_BOT_TOKEN', 'YOUR BOT TOKEN HERE')
    ],

Add the formatter for notificaiton

    use NotificationChannels\Telegram\TelegramMessage;
    use Pyaesone17\Lapse\ErrorNotifiable;
    ..
    
    class Handler extends ExceptionHandler
    {
        use ErrorNotifiable;
        ...
    
        public function report(Exception $exception)
        {
            if( app()->environment()!='local' ){ // Remove this line if you want lapse to notify in local environment
                $this->sendNotification($exception, $this->getFormatters());
            }
        }

        protected function getFormatters()
        {
            $formatters = array(
                'toTelegram' => function($notifiable) {
                    return TelegramMessage::create()
                    ->content("*HELLO!* \n One of your invoices has been paid!");
                }
            );

            return $formatters;
        }
        ...  
    }

New Feature

If you want new feature, feel free to submit as an issue

Security

If you discover any security related issues, please email promise@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

You can’t perform that action at this time.