PHP code example of jspapp / monolog-discord-handler

1. Go to this page and download the library: Download jspapp/monolog-discord-handler library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jspapp / monolog-discord-handler example snippets




app\MonologDiscord\DiscordHandler;

$webhook = 'Your Webhook URL';

$log = new Monolog\Logger('discord');
$log->pushHandler(new DiscordHandler($webhook, Logger::INFO));

$log->info('This is the title!', [
  'Information' => 'Context data will be shown as embedded information.',
  'Additional' => 'The footer of the card also displays the logger\'s name and error level, along with the event\'s timestamp.'
]);

use jspapp\MonologDiscord\Laravel\DiscordChannel;

'discord' => [
  'driver' => 'custom',
  'via' => DiscordChannel::class,
  'webhook' => env('LOG_DISCORD_WEBHOOK'),
],

Log::channel('discord')->info('Message');