PHP code example of guanguans / laravel-exception-notify

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

    

guanguans / laravel-exception-notify example snippets




use Guanguans\LaravelExceptionNotify\Facades\ExceptionNotify;
use Illuminate\Support\Arr;

public function boot(): void
{
    ExceptionNotify::skipWhen(static fn (\Throwable $throwable) => Arr::first(
        [
            \Symfony\Component\HttpKernel\Exception\HttpException::class,
            \Illuminate\Http\Exceptions\HttpResponseException::class,
        ],
        static fn (string $exception): bool => $throwable instanceof $exception
    ));
}



use Guanguans\LaravelExceptionNotify\Contracts\Channel;
use Guanguans\LaravelExceptionNotify\Facades\ExceptionNotify;
use Illuminate\Container\Container;

public function boot(): void
{
    ExceptionNotify::extend('YourChannelName', function (Container $container): Channel {
        return 'Instance of the `\Guanguans\LaravelExceptionNotify\Contracts\Channel`.';
    });
}
bash
php artisan vendor:publish --provider="Guanguans\\LaravelExceptionNotify\\ExceptionNotifyServiceProvider" --ansi -v
shell
php artisan exception-notify:test --ansi -v