slatch / telegram-bot-client
PHP client for telegram bots api
0.1.0
2021-10-09 13:57 UTC
Requires
- php: >=7.4
- ext-curl: *
- ext-json: *
- guzzlehttp/psr7: ^2.0
- psr/http-client: ^1.0
- psr/http-message: ^1.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-04-10 16:31:37 UTC
README
PHP client for telegram
Requirements
- PHP 7.4 or higher
- curl
- PSR-18 http client (for example, guzzle)
Installing
composer require "slatch/telegram-bot-client"
Usage
List of available methods: https://core.telegram.org/bots/api#available-methods
Example:
use Slatch\TelegramBotClient\Api\Config; use Slatch\TelegramBotClient\Arguments\SendMessage; use Slatch\TelegramBotClient\BotClient; use Slatch\TelegramBotClient\Bot\Credentials; ... // Initialize bot client $botClient = new BotClient($httpClient, new Credentials($token), new Config('https://api.telegram.org')); // Prepare message $message = new SendMessage(); $message->setChatId(12345678); $message->setText("Hello World!"); // Send $botClient->sendMessage($message);