tiagosampaio / telegram-bot-php
将您的PHP应用程序与Telegram机器人集成的最简单方法。
dev-master
2019-06-19 19:34 UTC
Requires
- php: ^7.0
- guzzlehttp/guzzle: ^6.3
- php-di/php-di: ^6.0
- tiagosampaio/data-object: dev-master
Requires (Dev)
- fzaninotto/faker: ^1.8
- phpmd/phpmd: ^2.6
- phpunit/phpunit: ^6.4
- squizlabs/php_codesniffer: ^3.3
This package is auto-updated.
Last update: 2024-09-20 07:20:04 UTC
README
Telegram Bot PHP
将您的PHP应用程序与Telegram机器人集成的最简单方法。
使用此Telegram机器人SDK创建强大的应用程序集成。简单到令人难以置信!!
查看使用示例有多简单
<?php /** * Inject the composer's autoload file. */ require_once __DIR__ . '/vendor/autoload.php'; /** * Assuming you already have the token created using the BotFather. */ $token = '[SOME TOKEN HASH]'; /** * And that you have the chat ID too, you can simply define the text you'd like to send, for instance. */ $chatId = [SOME CHAT ID]; $text = \Faker\Factory::create()->sentence(20); /** * Create and instance of the API by using the ApiFactory. * @var \Telegram\ApiInterface $api */ $api = \Telegram\ApiFactory::create($token); /** * And call the proper method. * @var \Telegram\Service\ResultInterface $response */ $response = $api->methods()->sendMessage($chatId, $text);
Telegram BotFather
此链接到 BotFather 将引导您创建自己的Telegram机器人。
作者
Tiago Sampaio - tiago@tiagosampaio.com
许可协议
Telegram Bot PHP 是由 Tiago Sampaio 于 2018 年末发起的个人项目。它免费使用。
请参阅 LICENSE.txt 文件以获取关于 OSL 许可协议的完整描述。