1. Go to this page and download the library: Download locky42/telegram-logger 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/ */
locky42 / telegram-logger example snippets
use Locky42\TelegramLogger\TelegramLogger;
// Initialize the logger
$logger = new TelegramLogger('YOUR_CHAT_ID', 'YOUR_BOT_TOKEN');
// Send a message
$logger->log('Test message');
// Send a message with log level
$logger->info('Information message');
$logger->warning('Warning');
$logger->error('Error');
use Locky42\TelegramLogger\TelegramLogger;
use Locky42\TelegramLogger\Config\TelegramConfig;
$config = new TelegramConfig([
'bot_token' => 'YOUR_BOT_TOKEN',
'chat_id' => 'YOUR_CHAT_ID',
'parse_mode' => 'HTML', // or 'Markdown'
'timeout' => 30,
'thread_id' => 123456789 // optional: message thread ID for group discussions
]);
$logger = new TelegramLogger($config);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.