PHP code example of jackmartin / laravel-email-exceptions

1. Go to this page and download the library: Download jackmartin/laravel-email-exceptions library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jackmartin / laravel-email-exceptions example snippets


Abrigham\LaravelEmailExceptions\EmailExceptionsServiceProvider::class,

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

use Abrigham\LaravelEmailExceptions\Exceptions\EmailHandler as ExceptionHandler;

'ErrorEmail' => [
    
    'email'                             => true,
    
    'useSystemEmail'                    => true,
    
    'dontEmail'                         => [],
    
    'throttle'                          => false,
    
    'throttleCacheDriver'               => env('CACHE_DRIVER', 'file'),
    
    'throttleDurationMinutes'           => 5,
    'dontThrottle'                      => [],
    
    'globalThrottle'                    => true,
    
    'globalThrottleLimit'               => 20,
    
    'globalThrottleDurationMinutes'     => 30,
    
    'toEmailAddress'                    => null,
    
    'fromEmailAddress'                  => null,

    'fromName'                          => null,
    
    'emailSubject'                      => null
]

'ErrorEmail' => [

    'email'                             => true,

    'useSystemEmail'                    => true,

    'dontEmail'                         => [],

    'throttle'                          => true,

    'throttleCacheDriver'               => env('CACHE_DRIVER', 'file'),

    'throttleDurationMinutes'           => 5,

    'dontThrottle'                      => [],

    'globalThrottle'                    => true,

    'globalThrottleLimit'               => 20,

    'globalThrottleDurationMinutes'     => 30,

    'toEmailAddress'                    => '[email protected]',

    'fromEmailAddress'                  => '[email protected]',

    'fromName'                          => 'Reports',

    'emailSubject'                      => null,

]

'EmailReports' => [

    'host'       => 'smtp.mailtrap.io',

    'port'       => 2525,

    'username'   => '',

    'password'   => '',

    'encryption' => 'tls',
]


class Handler extends ExceptionHandler
{
    protected function appSpecificDontEmail(Exception $exception)
    {
        // add logic here to determine if exception should be emailed return true
        // if it should and return false if it should not
    }
}
bash
php artisan vendor:publish --provider="Abrigham\LaravelEmailExceptions\EmailExceptionsServiceProvider"