efureev / loogger-driver-php
Laravel DB 的 PHP 支持包
v1.0.1
2022-06-17 08:39 UTC
Requires
- php: ^8.0
- ext-curl: *
Requires (Dev)
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.6
This package is auto-updated.
Last update: 2024-09-17 14:07:48 UTC
README
描述
PHP 驱动程序,用于将通知发送到 Telegram
服务。
安装
composer require efureev/loogger "^1.0"
使用
在您的代码中
$looggerConfig = new Config($looggerConfigJson); $loogger = new Loogger($looggerConfig); $loogger->send($msg); // ... $loogger ->pattern("<b>Gitlab</b>: {{MSG}}") ->sendHTML("<i>Hello from service</i>");
消息类型格式
$loogger ->asPlain() // send message as plain // ->send('Text') ->asHTML() // send message as HTML // ->send('<b>Bold</b> <pre>code</pre>') ->asMD() // send message as Markdown. // ->send('*Bold* text')
允许用于模式和消息的变量
MSG
- 消息内容SERVICE_NAME
- 服务名称SERVICE_DESCRIPTION
- 服务描述NOW
- 日期时间。格式:RFC822
CHAT_ID
- TG聊天 IDBR
- 返回到下一行的光标。类似于\n
。TAB
- 返回到下一行的光标。类似于\t
。
来自控制台文件
php send2loogger.php --msg='Testing message!'
参数
--cnf=<path>
- 配置文件的完整路径。配置文件应为 JSON 类型。--msg='<text>'
- 发送的消息--debug
- 启用调试模式
来自 curl
curl --location --request POST 'https://loogger.mockery.dev/push' \ --header 'X-Token: $2a$10$du8TEzvOs6HTgrbkuuTl0JNnhGF2Ki3xLKuPG5LoGBcn4S91W' \ --data-raw 'Hello from service'
使用 Loogger 服务
Loogger 是一个发送各种通知的服务。目前,它只有一个驱动程序:Telegram
。
服务位于 https://loogger.mockery.dev
。
要使用 Loogger 服务,您应该通过 Telegram 在那里注册
- 将 tg-bot
@Loogger
添加到您的群组或直接与其聊天。 - 注册 Loogger
对于个人聊天:您需要向其发送认证数据。
对于群组聊天:无需操作。 - 创建服务:
/add
在 /help
上接收到的完整命令列表