PHP code example of noroman / php-tglogger

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

    

noroman / php-tglogger example snippets




use TgLogger\TgLogger;

n = '528…74:AA…0s';

$log = new TgLogger($botToken, $chatId, 'project name [optional]');

try {
    $log->Error('test error', ['id' => 4, 'firstName' => 'Roman', 'lastName' => 'Novikov']);

} catch (Exception $e) {
    // to the standard log
    error_log($e->getMessage() .':: '. $log->getMessage());
}