seshac / exception-notification

Exception Notification (our better version of Sneaker package)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The Exception Notification package sends a mail notification when exception occurs in a Laravel application.

Latest Version on Packagist Tests Total Downloads

Installation

You can install the package via composer:

composer require javelinorg/exception-notification

You can publish the config file with:

php artisan vendor:publish --provider="Javelin\ExceptionNotification\ExceptionNotificationServiceProvider" --tag="config"

You can publish the view files with:

php artisan vendor:publish --provider="Javelin\ExceptionNotification\ExceptionNotificationServiceProvider" --tag="views"

This is the contents of the published config file:

return [

    /*
    |--------------------------------------------------------------------------
    | Exception Notification
    |--------------------------------------------------------------------------
    |
    | Exception notification enabled by default.
    | You can disable by setting enabled to false.
    */

    'enabled' => env('EXCEPTION_NOTIFICATION', true),

    /*
    |--------------------------------------------------------------------------
    | Error email recipients
    |--------------------------------------------------------------------------
    |
    | Here you can specify the list of recipients
    |
    */

    'from' => [
        'address' => env('MAIL_FROM_ADDRESS', 'foo@example.com'),
        'name'    => env('MAIL_FROM_NAME', 'Foo'),
    ],

    /*
    |--------------------------------------------------------------------------
    | Error email recipients
    |--------------------------------------------------------------------------
    |
    | Here you can specify the list of recipients
    |
    */

    'toAddresses' => [
        "bar@example.com"
    ],

    /*
    |--------------------------------------------------------------------------
    | Queue customization
    |--------------------------------------------------------------------------
    |
    | Exception notificaiton will send throuh the queue by default,
    | Howerver you can customize it as per your needs.
    |
    */

    'queueOptions' => [
        'enabled' => env('EXCEPTION_NOTIFICATION_SHOULD_QUEUE',true),
        'queue' => env('EXCEPTION_NOTIFICATION_QUEUE_NAME', "default"),
        'connection' => env('QUEUE_DRIVER', 'redis'),
    ],

    /*
    |--------------------------------------------------------------------------
    | A list of the exception types that should be reported.
    |--------------------------------------------------------------------------
    |
    | For which exception class emails should be sent?
    |
    | You can use '*' in the array which will in turn reports every
    | exception.
    |
    */

    'report' => [
      '*',
    ],

    /*
    |--------------------------------------------------------------------------
    | Crawler Bots
    |--------------------------------------------------------------------------
    |
    | Ignore Crawler Bots
    | You can use '*" in the array to ignore all kind of bots or you can specify only particular bots.
    |
    */

    'ignored_bots' => [
       '*',
    ],
];

Usage

Just add at report method in App/Exceptions/Handler file.

public function report(Exception $exception) 
{
   
   app(ExceptionNotification::class)->reportException($exception);
    
   parent::report($exception);
    
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

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

About

Exception Notification (our better version of Sneaker package)

License:MIT License


Languages

Language:PHP 81.4%Language:HTML 18.6%