Looking to hire Laravel developers? Try LaraJobs

laravel-discord-webhook-log maintained by eslym

Description
A Discord webhook handler for monolog in laravel
Author
Last update
2022/03/05 02:53 (dev-main)
License
Links
Downloads
548
Tags

Comments
comments powered by Disqus

A Discord webhook handler for monolog in laravel

<?php
# config/logging.php

return [
// ...

    'channels' => [

// ...

        'discord' => [
            'driver' => 'monolog',
            'handler' => \Eslym\Laravel\Log\DiscordWebhook\DiscordWebhookHandler::class,
            'with' => [
                'webhook' => env('DISCORD_LOG_WEBHOOK'),
                'message' => env('DISCORD_LOG_MESSAGE'),
            ],
            'formatter' => \Monolog\Formatter\LineFormatter::class,
            'formatter_with' => [
                'format' => '%message% %context% %extra%',
                'allowInlineLineBreaks' => true,
                'ignoreEmptyContextAndExtra' => true,
            ],
        ],

// ...

    ],

// ...
]
# .env
DISCORD_LOG_WEBHOOK="webhook url"
DISCORD_LOG_MESSAGE="Hey <@ (discord user id here) >! here is your log."