tomatophp/laravel-discord-error-tracker
最新稳定版本:v1.0.0
Composer 安装命令:
composer require tomatophp/laravel-discord-error-tracker
包简介
Track Your Errors using Discord Webhook on any Laravel App
README 文档
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
统计信息
- 总下载量: 448
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-01-08