doker42/laravel-telegram-log
最新稳定版本:1.0
Composer 安装命令:
composer require doker42/laravel-telegram-log
包简介
laravel logger to telegram chat
README 文档
README
Desctiption: sending error or info messages to target telegram chat from laravel application. Using two channels (info/error). Possibility use different bots for sending messeges or using only one bot and one chat. Git link https://github.com/doker42/telegramlog
instalation
- composer require doker42/laravel-telegram-log
add config file telegramlog.php to config directory
return [
'channels' => [
'info' => [
'bot_token' => env('TELEGRAM_BOT_TOKEN'),
'chat_group_id' => env('TELEGRAM_LOG_INFO_CHAT_GROUP_ID')
],
'error' => [
'bot_token' => env('TELEGRAM_BOT_TOKEN'),
'chat_group_id' => env('TELEGRAM_LOG_ERROR_CHAT_GROUP_ID')
],
],
];
add data to .env, telegramBotId, telegramChatId
TELEGRAM_BOT_TOKEN=<token>
TELEGRAM_LOG_INFO_CHAT_GROUP_ID=<chat_group_id>
TELEGRAM_LOG_ERROR_CHAT_GROUP_ID=<chat_group_id>
basic usage
use Doker42\Telegramlog\TelegramLogger;
$message = [
'text' => 'test text',
'message' => 'test message',
...
];
/** INFO log chat */
TelegramLogger::dispatch($message, TelegramLogger::TYPE_INFO);
/** ERROR log chat */
TelegramLogger::dispatch($message, TelegramLogger::TYPE_ERROR);
统计信息
- 总下载量: 26
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-04-14