PHP code example of tomatophp / laravel-discord-error-tracker

1. Go to this page and download the library: Download tomatophp/laravel-discord-error-tracker 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/ */

    

tomatophp / laravel-discord-error-tracker example snippets




use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use TomatoPHP\LaravelDiscordErrorTracker\Services\DiscordServices;

return Application::configure(basePath: dirname(__DIR__))
    ->withRouting(
        web: __DIR__.'/../routes/web.php',
        commands: __DIR__.'/../routes/console.php',
        health: '/up',
    )
    ->withMiddleware(function (Middleware $middleware) {
        //
    })
    ->withExceptions(function (Exceptions $exceptions) {
        DiscordServices::handler($exceptions);
    })->create();



namespace App\Exceptions;

use TomatoPHP\LaravelDiscordErrorTracker\Services\DiscordServices;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
    /**
     * The list of the inputs that are never flashed to the session on validation exceptions.
     *
     * @var array<int, string>
     */
    protected $dontFlash = [
        'current_password',
        'password',
        'password_confirmation',
    ];

    /**
     * Register the exception handling callbacks for the application.
     */
    public function register(): void
    {
        $this->reportable(function (Throwable $exception) {
            DiscordServices::handler($exception);
        });
    }
}




use TomatoPHP\LaravelDiscordErrorTracker\Services\DiscordServices;

$exception = new \Exception('Test Exception');
DiscordServices::handler($exception);
bash
php artisan vendor:publish --tag="laravel-discord-error-tracker-config"
bash
composer analyse