• Stars
    star
    222
  • Rank 179,123 (Top 4 %)
  • Language
    PHP
  • License
    MIT License
  • Created about 8 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An easy way to send emails whenever an exception occurs on server.

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

For Laravel <= 5.2, please use the v1 branch!

For Laravel 5.2 < version <= 6.x, please use the v5 branch!

$ composer require squareboat/sneaker

Configure Laravel

If you are using laravel 5.5 or higher you should skip this step.

If you are using laravel 5.3 or 5.4, simply add the service provider to your project's config/app.php file:

Service Provider

SquareBoat\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="SquareBoat\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="SquareBoat\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.

Sneak

Test your integration

To verify that Sneaker is configured correctly and our integration is working, use sneaker:sneak Artisan command:

$ php artisan sneaker:sneak

A SquareBoat\Sneaker\Exceptions\DummyException class will be thrown and captured by Sneaker. The captured exception will appear in your configured email immediately.

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 © 2020 SquareBoat

More Repositories

1

nestjs-boilerplate

A production-ready 🏭 NestJS boilerplate with batteries 🔋 included. No Kidding! Now Supports NestJS V10!!
TypeScript
674
star
2

nest-mailman

📮 The mailer package for your NestJS Applications.
TypeScript
214
star
3

nest-storage

A multi-disk multi-driver filesystem manager for NestJS. 💾
TypeScript
101
star
4

api-guidelines

Squareboat's best practices for writing REST API's.
87
star
5

growth-hacking-guide

A community driven growth hacking guide for startups.
73
star
6

nest-console

Create beautiful CLI commands in your NestJS Applications
TypeScript
58
star
7

sql-doctor

Quickly debugging the amount of database queries per request in Laravel.
PHP
56
star
8

nest-queue

The queue package for your NestJS Applications
TypeScript
46
star
9

security-guidelines

Squareboat's best practices for building highly secure websites and apps.
41
star
10

nest-eyewitness

Receive error reports directly to your inbox whenever any exception is witnessed 👀 in your NestJS application.
TypeScript
33
star
11

Excuser

An Android app which trigger a fake call on the device, just by shaking android wear on your wrist.
Java
28
star
12

serverless-media-worker

A simple out of the box serverless media worker 🧑‍🏭 for your media processing tasks.
JavaScript
27
star
13

nestjs-localization

Nestjs localization provides a convenient way to retrieve strings in various languages, allowing you to easily support multiple languages within your application.
TypeScript
25
star
14

alert

An easy way for Laravel flash notifications using sweetalert JS plugin.
PHP
19
star
15

nest-notifications

Multi-Channel, Single API package for NestJS
TypeScript
17
star
16

nest-events

Integrate event listeners easily inside your nestjs application.
TypeScript
16
star
17

flash

An easy way for Laravel flash notifications.
PHP
14
star
18

nestjs-objection

ObjectionJS on steroids for your nestjs application!
TypeScript
14
star
19

SecretKeys

This is source code for medium article: Securing API Keys inside Android Apps using Android NDK
Java
13
star
20

baker

A set of helpers for baking your Laravel Project.
PHP
11
star
21

nest-cache

Cache Module for your NestJS applications.
TypeScript
10
star
22

ansible-webserver-scripts

Ansible scripts to automate installation of a web server.
HTML
9
star
23

swift-utilities-package

Utilities is a Swift package of almost all the utility functions needed to build amazing iOS Applications.
Swift
8
star
24

react-boilerplate

JavaScript
7
star
25

nest-firebase

Firebase Package for NestJS.
TypeScript
7
star
26

splinter

Splinter is a platform agnostic migration tool written in go.
Go
6
star
27

native-mathjax

A simple NPM nodule to show Mathematical equations using MathJAX in React Native using Webview.
JavaScript
6
star
28

nest-queue-sqs

Package for AWS SQS strategy package for @squareboat/nest-queue
TypeScript
5
star
29

nest-social-auth

TypeScript
4
star
30

swiftUI-sample-project

Sample Project for SwiftUI
Swift
4
star
31

nest-queue-redis

Package for Redis strategy package for @squareboat/nest-queue
TypeScript
4
star
32

google-sheets

Integrate Google Sheets into your Laravel application with breeze.
PHP
4
star
33

fastapi-boilerplate

Python
4
star
34

the-winning-cube

A 3d puzzle using three.js. You need to make the cube reach its final goal.
JavaScript
2
star
35

nestjs-socket

TypeScript
2
star
36

keycloak-cjs

JavaScript
1
star
37

nestjs-logger

A simplified winston logger for your NestJS Applications.
TypeScript
1
star
38

cleanbox

JavaScript
1
star
39

LaraHub

LaraHub is a Docker PHP development environment. It is configured to run Laravel Apps on Docker with suitable enviornment.
Dockerfile
1
star
40

micro-test-cases

Test cases for common features
1
star
41

nest-queue-strategy

TypeScript
1
star
42

nest-postman

TypeScript
1
star