Giter Club home page Giter Club logo

sneaker's Introduction

Laravel Exception Notifications

An easy way to send emails with stack trace whenever an exception occurs on the server for Laravel Applications.

sneaker example image

Install

Install via composer

$ composer require yocmen/sneaker ^1.0

Configure Laravel

Once installation operation is complete, simply add the service provider to your project's config/app.php file:

Service Provider

Yocmen\Sneaker\SneakerServiceProvider::class,

Add Sneaker's Exception Capturing

Add exception capturing to app/Exceptions/Handler.php:

public function report(Exception $exception)
{
    app('sneaker')->captureException($exception);

    parent::report($exception);
}

Configuration File

Create the Sneaker configuration file with this command:

$ php artisan vendor:publish --provider="Yocmen\Sneaker\SneakerServiceProvider"

The config file will be published in config/sneaker.php

Following are the configuration attributes used for the sneaker.

silent

The package comes with 'silent' => true, configuration by default, since you probably don't want error emailing enabled on your development environment. Especially if you've set 'debug' => true,.

'silent' => env('SNEAKER_SILENT', true),

For sending emails when an exception occurs set SNEAKER_SILENT=false in your .env file.

capture

It contains the list of the exception types that should be captured. You can add your exceptions here for which you want to send error emails.

By default, the package has included Symfony\Component\Debug\Exception\FatalErrorException::class.

'capture' => [
    Symfony\Component\Debug\Exception\FatalErrorException::class,
],

You can also use '*' in the $capture array which will in turn captures every exception.

'capture' => [
    '*'
],

To use this feature you should add the following code in app/Exceptions/Handler.php:

public function report(Exception $exception)
{
    if ($this->shouldReport($exception)) {
        app('sneaker')->captureException($exception);
    }

    parent::report($exception);
}

to

This is the list of recipients of error emails.

'to' => [
        // '[email protected]',
    ],

ignored_bots

This is the list of bots for which we should NOT send error emails.

'ignored_bots' => [
    'googlebot',        // Googlebot
    'bingbot',          // Microsoft Bingbot
    'slurp',            // Yahoo! Slurp
    'ia_archiver',      // Alexa
],

Customize

If you need to customize the subject and body of email, run following command:

$ php artisan vendor:publish --provider="Yocmen\Sneaker\SneakerServiceProvider"

Note - Don't run this command again if you have run it already.

Now the email's subject and body view are located in the resources/views/vendor/sneaker directory.

We have passed the thrown exception object $exception in the view which you can use to customize the view to fit your needs.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

About Squareboat

Squareboat is a startup focused, product development company based in Gurgaon, India. You'll find an overview of all our open source projects on GitHub.

License

The MIT License. Please see License File for more information. Copyright © 2016 SquareBoat

sneaker's People

Contributors

yocmen avatar

Stargazers

Ryan Eby avatar Kevyworks avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.