2017 © Pedro Peláez
 

library lapse

image

pyaesone17/lapse

  • Monday, July 30, 2018
  • by pyaesone17
  • Repository
  • 5 Watchers
  • 145 Stars
  • 190 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 0 Open issues
  • 17 Versions
  • 58 % Grown

The README.md

Example, (*1)

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/., (*2)

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., (*3)

For old version please see documentation at https://github.com/pyaesone17/lapse/tree/v1, (*4)

Upgrade Guide

If you are upgrading from version 1., (*5)

Please delete config/lapse.php file first., (*6)

Install

Install Via Composer, (*7)

``` bash $ composer require pyaesone17/lapse, (*8)


Publish vendor ``` bash $ php artisan vendor:publish

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

``` php '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'], (*10)


``` bash $ php artisan vendor:publish

Migrate lapses table, (*11)

``` bash php artisan migrate, (*12)

## Usage

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


``` php

    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., (*13)

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

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

``` bash
$ php artisan clear:lapse

Custom Notification Channel

you can use all notifications from http://laravel-notification-channels.com/ to integrate with lapse, (*15)

For example, Telegram, (*16)

install channel via composer, (*17)

``` bash $ composer require laravel-notification-channels/telegram, (*18)


configure the config/lapse.php first ``` php 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, (*19)

``` php // config/app.php 'providers' => [ ... NotificationChannels\Telegram\TelegramServiceProvider::class, ],, (*20)


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

Add the formatter for notificaiton ``` php use NotificationChannels\Telegram\TelegramMessage; use Pyaesone17\Lapse\ErrorNotifiable; .., (*21)

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;
    }
    ...  
}

```, (*22)

New Feature

If you want new feature, feel free to submit as an issue, (*23)

Security

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

Credits

License

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

The Versions

30/07 2018

dev-master

9999999-dev https://github.com/pyaesone17/lapse

  Sources   Download

MIT

The Requires

 

The Development Requires

pyaesone17 lapse

30/07 2018

v2.x-dev

2.9999999.9999999.9999999-dev https://github.com/pyaesone17/lapse

  Sources   Download

MIT

The Requires

 

The Development Requires

pyaesone17 lapse

23/07 2018

2.0.7

2.0.7.0 https://github.com/pyaesone17/lapse

  Sources   Download

MIT

The Requires

 

The Development Requires

pyaesone17 lapse

22/07 2018

2.0.6

2.0.6.0 https://github.com/pyaesone17/lapse

  Sources   Download

MIT

The Requires

 

The Development Requires

pyaesone17 lapse

22/07 2018

2.0.5

2.0.5.0 https://github.com/pyaesone17/lapse

  Sources   Download

MIT

The Requires

 

The Development Requires

pyaesone17 lapse

22/07 2018

2.0.4

2.0.4.0 https://github.com/pyaesone17/lapse

  Sources   Download

MIT

The Requires

 

The Development Requires

pyaesone17 lapse

22/07 2018

2.0.3

2.0.3.0 https://github.com/pyaesone17/lapse

  Sources   Download

MIT

The Requires

 

The Development Requires

pyaesone17 lapse

22/07 2018

2.0.2

2.0.2.0 https://github.com/pyaesone17/lapse

  Sources   Download

MIT

The Requires

 

The Development Requires

pyaesone17 lapse

22/07 2018

2.0.1

2.0.1.0 https://github.com/pyaesone17/lapse

  Sources   Download

MIT

The Requires

 

The Development Requires

pyaesone17 lapse

22/07 2018

2.0.0

2.0.0.0 https://github.com/pyaesone17/lapse

  Sources   Download

MIT

The Requires

 

The Development Requires

pyaesone17 lapse

19/10 2017

v1.x-dev

1.9999999.9999999.9999999-dev https://github.com/pyaesone17/lapse

  Sources   Download

MIT

The Requires

 

The Development Requires

pyaesone17 lapse

13/10 2017

1.0.6

1.0.6.0 https://github.com/pyaesone17/lapse

  Sources   Download

MIT

The Requires

 

The Development Requires

pyaesone17 lapse

13/10 2017

1.0.5

1.0.5.0 https://github.com/pyaesone17/lapse

  Sources   Download

MIT

The Requires

 

The Development Requires

pyaesone17 lapse

13/10 2017

1.0.4

1.0.4.0 https://github.com/pyaesone17/lapse

  Sources   Download

MIT

The Requires

 

The Development Requires

pyaesone17 lapse

13/10 2017

1.0.2

1.0.2.0 https://github.com/pyaesone17/lapse

  Sources   Download

MIT

The Requires

 

The Development Requires

pyaesone17 lapse

13/10 2017

1.0.1

1.0.1.0 https://github.com/pyaesone17/lapse

  Sources   Download

MIT

The Requires

 

The Development Requires

pyaesone17 lapse

13/10 2017

1.0.0

1.0.0.0 https://github.com/pyaesone17/lapse

  Sources   Download

MIT

The Requires

 

The Development Requires

pyaesone17 lapse