PHP code example of cmdisp / monolog-microsoft-teams

1. Go to this page and download the library: Download cmdisp/monolog-microsoft-teams 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/ */

    

cmdisp / monolog-microsoft-teams example snippets


$logger = new \Monolog\Logger('app');
$logger->pushHandler(new \CMDISP\MonologMicrosoftTeams\TeamsLogHandler('INCOMING_WEBHOOK_URL', \Monolog\Level::Error));

$logger->error('Error message');

'teams' => [
    'driver' => 'custom',
    'via' => \CMDISP\MonologMicrosoftTeams\TeamsLogChannel::class,
    'level' => 'error',
    'url' => 'INCOMING_WEBHOOK_URL',
],

Log::channel('teams')->error('Error message');

'channels' => [
    'stack' => [
        'driver' => 'stack',
        'channels' => ['single', 'teams'],
    ],
],