rde/php-telegram-connection
Composer 安装命令:
composer require rde/php-telegram-connection
包简介
Telegram API connection
README 文档
README
簡化 telegram api 請求
用法
建立連線
use Rde\Telegram\Connection; // 成功建立連線後, $conn->me 會存放此 bot 的 id 資料 $conn = new Connection($token);
$token取得方式請參考 Telegram Bot Token$conn->me結構請參考 Telegram Bot API getMe
發送訊息
use Rde\Telegram\Structure; $payload = new Structure(array( 'chat_id' => $int )); $payload->{'text'} = 'some text string'; $telegram_response = $conn->sendMessage($payload);
使用 post
$conn->method('POST'); //$conn->sendMessage($payload);
cli tool
bot api 轉發
$ ./bot <token|bot_name> <method> [payload]
使用 post
$ METHOD=POST ./bot <token|bot_name> <method> [payload]
發送訊息
$ ./send <token|bot_name> <chat_id> 'your text'
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-06-01