holdmann/monolog-telegram-async
最新稳定版本:v1.0.0
Composer 安装命令:
composer require holdmann/monolog-telegram-async
包简介
Handler for Monolog to send logs by Telegram asynchronously
README 文档
README
Handler for Monolog to send logs by Telegram asynchronously in HTML format
Requirements
- PHP 7.4 or above
- Guzzle 7+
Installation with composer
composer require holdmann/monolog-telegram-async
Declaring handler object
To declare this handler, you need to know the bot token and the chat identifier(chat_id) to which the log will be sent.
// ... $handler = new \Holdmann\Monolog\TelegramAsyncHandler('<token>', <chat_id>, <log_level>); // ...
Example:
$log = new \Monolog\Logger('telegram_channel'); $handler = new \Holdmann\Monolog\TelegramAsyncHandler( '000000000:XXXXX-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 123456789, \Monolog\Logger::DEBUG ); $handler->setFormatter(new \Monolog\Formatter\LineFormatter("%message%", null, true)); $log->pushHandler($handler); $log->debug('Test message');
The above example is using standard LineFormatter from Monolog package. You can write and use your own message formatter for better logs format.
Example with proxy (for russian servers):
$handler = new \Holdmann\Monolog\TelegramAsyncHandler('<token>', <chat_id>, <log_level>); $handler->setProxy('http://username:password@192.168.16.1:80'); // or simply 'http://192.168.16.1:80' $handler->setFormatter(new \Monolog\Formatter\LineFormatter("%message%", null, true));
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-28