oscarweb/laravel-discord-report

Discord Report - Log Error.

0.2.4 2024-06-30 17:00 UTC

This package is auto-updated.

Last update: 2024-12-30 18:05:09 UTC


README

It is a package to send errors that are logged in the Laravel application directly to a Discord channel.

- Install vía Composer

composer require oscarweb/laravel-discord-report

Or you can add this line to your composer.json file:

"oscarweb/laravel-discord-report": "^0.2.4"

and run

composer update

- Publish the service provider

php artisan vendor:publish --provider "LaravelDiscordReport\ServiceProvider"

- Add a Webhook

In your .env file you need to add the environment variable.

LDR_WEBHOOK_URL="https://discord.com/api/webhooks/.../..."

- Add Channel

You must add the new channel to your configuration file:

laravel_discord_report

# /config/logging.php

return [
    /** ... */
    'default' => env('LOG_CHANNEL', 'stack'),
    /** ... */
    'channels' => [
        'stack' => [
            'driver' => 'stack',
            //add channel: laravel_discord_report ↓
            'channels' => ['single','laravel_discord_report'], 
            'ignore_exceptions' => false,
        ],

- Save Config

php artisan config:cache

- Testing

Example Command

Other environment variables

You can add these variables in your .env file

- Example in your .env file:

LDR_WEBHOOK_URL="https://discord.com/api/webhooks/.../..."
LDR_WEBHOOK_USERNAME="Test API Report"
LDR_WEBHOOK_AVATAR="https://i.imgur.com/oBPXx0D.png"

Save config:

php artisan config:cache