PHP code example of vladimir-yuldashev / monolog-telegram

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

    

vladimir-yuldashev / monolog-telegram example snippets




use Monolog\Logger;
use VladimirYuldashev\Monolog\TelegramHandler;

$telegramToken = '';
$chatId = 1;

$handler = new TelegramHandler(
    Logger::ERROR,
    $telegramToken,
    $chatId
);

$log = new Logger('name');
$log->pushHandler($handler);

// add records to the log
$log->warning('Foo');
$log->error('Bar');