Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 873 Bytes

File metadata and controls

41 lines (31 loc) · 873 Bytes

telegram-bot-client

PHP client for telegram

Requirements

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);