PHP code example of berndengels / laravel-email-exceptions

1. Go to this page and download the library: Download berndengels/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/ */

    

berndengels / laravel-email-exceptions example snippets


use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

use Bengels\LaravelEmailExceptions\Exceptions\EmailHandler as ExceptionHandler;

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

'ErrorEmail' => [
    'email' => true,
    'dontEmail' => [],
    'throttle' => true,
    'throttleCacheDriver' => env('CACHE_DRIVER', 'file'),
    'throttleDurationMinutes' => 5,
    'dontThrottle' => [],
    'globalThrottle' => true,
    'globalThrottleLimit' => 20,
    'globalThrottleDurationMinutes' => 30,
    'toEmailAddress' => explode(',', env('EXCEPTION_TO_EMAIL_ADDRESS', '[email protected]')),
    'fromEmailAddress' => env('EXCEPTION_FROM_EMAIL_ADDRESS', '[email protected]'),
    'emailSubject' => env('EXCEPTION_EMAIL_SUBJECT', null),
]


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="Bengels\LaravelEmailExceptions\EmailExceptionsServiceProvider"