/monolog-discord

This package for sending logs of discord to a webhook channel

Primary LanguagePHPMIT LicenseMIT

unixoff/monolog-discord

Latest Stable Version Latest Unstable Version License PHP Version Require

This package for sending logs of discord to a webhook channel


Installation

composer require unixoff/monolog-discord

Usage

<?php

require 'vendor/autoload.php';

use unixoff\MonologDiscord\DiscordWebhookHandler;

$webhook = 'Your Webhook URL';

$log = new Monolog\Logger('discord');
$log->pushHandler(new DiscordWebhookHandler($webhook));

$log->info('hello world!');

Sample image

Symfony setting

monolog:
    handlers:
        main:
            ...
        discord_webhook_handler:
            type: service
            id: discord_webhook_handler

services:
    discord_webhook_handler:
        class: MonologDiscord\DiscordWebhookHandler
        arguments:
            $webhookUrl: '%env(string:DISCORD_WEBHOOK)%'

License

See the LICENSE file for license rights and limitations (MIT).