slatch/telegram-bot-client

PHP client for telegram bots api

0.1.0 2021-10-09 13:57 UTC

This package is auto-updated.

Last update: 2024-04-10 16:31:37 UTC


README

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