tomatophp / laravel-discord-error-tracker
Track Your Errors using Discord Webhook on any Laravel App
Fund package maintenance!
3x1io
Requires
- php: ^8.1|^8.2
- guzzlehttp/guzzle: *
- laravel/framework: *
Requires (Dev)
- laravel/pint: ^1.18
- livewire/livewire: ^2.10|^3.0
- nunomaduro/larastan: ^2.9
- orchestra/testbench: ^9.5
- pestphp/pest: ^2.36
- pestphp/pest-plugin-laravel: ^2.4
- pestphp/pest-plugin-livewire: ^2.1
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^1.2
- phpstan/phpstan-phpunit: ^1.4
This package is auto-updated.
Last update: 2025-01-08 03:38:45 UTC
README
Laravel Discord Error Tracker
Track Your Errors using Discord Webhook on any Laravel App
Installation
composer require tomatophp/laravel-discord-error-tracker
on your env
DISCORD_ERROR_WEBHOOK_ACTIVE=true #Enable And Disable Log DISCORD_ERROR_EVERYONE=true #Enable And Disable @everyone alert on the message DISCORD_ERROR_WEBHOOK= #Your Discord Server Channel Webhook URL
Using
if you are using Laravel 11 or above use this code, at bootstrap/app.php
<?php 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();
if you are using Laravel 10, use this code, at app\Exceptions\Handler.php
<?php 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); }); } }
this way will log all errors on your app, if you like to log selected error you can use this method direct
<?php use TomatoPHP\LaravelDiscordErrorTracker\Services\DiscordServices; $exception = new \Exception('Test Exception'); DiscordServices::handler($exception);
Publish Assets
you can publish config file by use this command
php artisan vendor:publish --tag="laravel-discord-error-tracker-config"
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security
Please see SECURITY for more information about security.
Credits
License
The MIT License (MIT). Please see License File for more information.
Testing
if you like to run PEST
testing just use this command
composer test
Code Style
if you like to fix the code style just use this command
composer format
PHPStan
if you like to check the code by PHPStan
just use this command
composer analyse
Other Filament Packages
Checkout our Awesome TomatoPHP