PHP code example of culy / monolog-microsoft-teams

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

    

culy / monolog-microsoft-teams example snippets


$logger = new \Culy\Microsoft\Teams\TeamsLogger('INCOMING_WEBHOOK_URL', \Monolog\Logger::ERROR);
$logger->error('Error message');

$logger = new \Monolog\Logger('app');
$logger->pushHandler(new \Culy\Microsoft\Teams\TeamsLogHandler('INCOMING_WEBHOOK_URL', \Monolog\Logger::ERROR));

'teams' => [
    'driver' => 'custom',
    'via' => \Culy\Microsoft\Teams\TeamsLogChannel::class,
    'level' => 'error',
    'url' => 'INCOMING_WEBHOOK_URL',
],

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

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