Blog Detail


Send Error Notifications of Laravel  App to Email & Slack cover image

arrow_back Send Error Notifications of Laravel App to Email & Slack

The Laravel Error Notifier package sends you an email and a slack notification whenever 500 internal server errors happen in your application. This package only works for laravel 8 and 9.

How to install

Run this command in the terminal.

composer require jgodstime/laravel-error-notifier

In your /app/Exceptions/Handler.php file, in the register method, add \ErrorNotifier\Notify\Helper::getError($e); this must be inside reportable callback

    public function register()
    	$this->reportable(function (Throwable  $e)  {

Disable Instant Notification

By default this package sends a notification immediately after the error occurred i.e without waiting for the users description of the error, you can disable this by adding
NOTIFIER_INSTANT=false in your .env file.

Publish the vendor files

php artisan vendor:publish --provider="ErrorNotifier\Notify\ErrorNotifierServiceProvider"

Now the vendor files are published in their respective paths

Setup your email driver

To set up your email driver, you can use mailtrap for test purposes.


Add your slack webhook (Optional)

To set up your slack webhook URL


To test this, simply add $array[‘key1’] = ‘john’; $data = $array[‘key2’]; in one of your routes, then hit the route In your browser.

    Route::get('/convert/file', function(){
    	 $array['key1'] = 'john';
        $data  = $array['key2'];

Notice that we are trying to access an array with key2 that doesn’t exist, this will throw an error and the package will send the error as a notification to your email as well as the trace.

Also, you must turn APP_DEBUG=false in your .env file.

Send Email to Multiple Recipients

You can send notifications to multiple recipients by adding multiple emails as a string in a comma-separated format without space


Change Redirect Page URL
You can change the page user is taken to after submitting the form, by default it goes to the home page (/)


Closing Note

Codebrisk is here to help you grow your business. Our expert developers have plenty of experience in Laravel Custom Web Application Development. We can enhance the performance of applications with easy syntax, third-party API integrations, and built-in functions, followed by a high level of security to prevent unauthorized access to data. We always provide a customized website solution tailored to our client’s needs. So if you’re interested, you can get in touch with us or get a free quote from us.

Published at : 29-09-2022

Author : Rizwan Aslam
Rizwan Aslam

I am a highly results-driven professional with 12+ years of collective experience in the grounds of web application development especially in laravel, native android application development in java, and desktop application development in the dot net framework. Now managing a team of expert developers at Codebrisk.

Launch your project

Launch project