PHP code example of darshan / exceptionemail

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

    

darshan / exceptionemail example snippets


namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Throwable;

class ExceptionServiceProvider extends ServiceProvider
{
    public function register()
    {
        // Nothing here for now.
    }

    public function boot()
    {
        app()->error(function (Throwable $e) {
            app('exceptionemail')->captureException($e);
        });
    }
}

return [
    // Other service providers...
    App\Providers\ExceptionServiceProvider::class,
],

use Throwable;

public function report(Throwable $exception)
{
    app('exceptionemail')->captureException($exception);

    parent::report($exception);
}

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

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

'capture' => [
    '*'
],

'ignored_exception' => [
    // Webmonks\ExceptionEmail\Exceptions\DummyException::class,
],

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

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

    parent::report($exception);
}

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

'ignored_bots' => [
    'googlebot',
    'bingbot',
    'slurp', 
    'ia_archiver',
],
bash
php artisan vendor:publish --provider="Webmonks\ExceptionEmail\ExceptionEmailServiceProvider"
bash
php artisan vendor:publish --provider="Webmonks\ExceptionEmail\ExceptionEmailServiceProvider"
bash
php artisan exceptionemail:test