gest / telegest
Small telegram library
Requires
- guzzlehttp/guzzle: ^7.8
- php-di/php-di: ^7.0
- react/event-loop: ^0.4.3
- react/http: ^0.4.0
- react/promise: ^2.11
Requires (Dev)
- phpunit/phpunit: ^9.6
This package is auto-updated.
Last update: 2025-03-11 20:32:36 UTC
README
π Description
gest/telegest is a small PHP library for interacting with the Telegram Bot API. It is designed to simplify the process of creating and managing Telegram bots, presenting a user-friendly interface for working with the Telegram API.
π Features
- Sending messages and media files
- Processing incoming messages and commands
- Asynchronous HTTP request support via Guzzle and ReactPHP
- Dependency injection using PHP-DI
βοΈ Installation
You can install the library using Composer:
composer require gest/telegest
π Usage/Examples
π€ Echo bot
$bot = new TGBot($token); $bot ->getUpdateHandler() ->attachCallable(UpdateType::Message, fn($message) => (new TGBotClient)->sendMessage($message)) ->handleUpdates() ->run();
Answer on inline query
$bot = new TGBot($token); $bot ->getUpdateHandler() ->attachCallable(UpdateType::InlineQuery, function ($query) use ($bot) { $builder = (new InlineQueryAnswerBuilder($query->id)) ->addArticleResult('1', 'test', '/delete') ->addPhotoResult('2', 'https://w7.pngwing.com/pngs/140/284/png-transparent-animated-woody-illustation-buzz-lightyear-sheriff-woody-jessie-toy-story-film-toy-story-cartoon-pixar-toy-story-3.png', 'https://www.pinclipart.com/picdir/big/209-2099521_thumb-up-comments-english-lovers-clipart.png') ->addLocationResult('3', 48.90174, 2.27829, 'ΠΠ°ΡΠΈΠΆ'); (new TGBotClient)->sendAnswerInlineQuery($builder); }) ->handleUpdates() ->run();
π οΈ Stack
Bible Library: ReactPHP, Guzzle, PHP-DI
π Support
gest/telegest
π ΠΠΏΠΈΡΠ°Π½ΠΈΠ΅
gest/telegest - ΡΡΠΎ Π½Π΅Π±ΠΎΠ»ΡΡΠ°Ρ PHP-Π±ΠΈΠ±Π»Π΅ΠΎΡΠ΅ΠΊΠ° Π΄Π»Ρ Π²Π·Π°ΠΈΠΌΠΎΠ΄Π΅ΠΉΡΡΠ²ΠΈΡ Ρ API Telegram Bot. ΠΠ½Π° ΠΏΡΠ΅Π΄Π½Π°Π·Π½Π°ΡΠ΅Π½Π° Π΄Π»Ρ ΡΠΏΡΠΎΡΠ΅Π½ΠΈΡ ΠΏΡΠΎΡΠ΅ΡΡΠ° ΡΠΎΠ·Π΄Π°Π½ΠΈΡ ΠΈ ΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΡ Telegram-Π±ΠΎΡΠ°ΠΌΠΈ, ΠΏΡΠ΅Π΄ΡΡΠ°Π²Π»ΡΡ ΡΠ΄ΠΎΠ±Π½ΡΠΉ ΠΈΠ½ΡΠ΅ΡΡΠ΅ΠΉΡ Π΄Π»Ρ ΡΠ°Π±ΠΎΡΡ Ρ API Telegram.
π ΠΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡΠΈ
- ΠΡΠΏΡΠ°Π²ΠΊΠ° ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΠΉ ΠΈ ΠΌΠ΅Π΄ΠΈΠ°ΡΠ°ΠΉΠ»ΠΎΠ²
- ΠΠ±ΡΠ°Π±ΠΎΡΠΊΠ° Π²Ρ ΠΎΠ΄ΡΡΠΈΡ ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΠΉ ΠΈ ΠΊΠΎΠΌΠ°Π½Π΄
- ΠΠΎΠ΄Π΄Π΅ΡΠΆΠΊΠ° Π°ΡΠΈΠ½Ρ ΡΠΎΠ½Π½ΠΎΠ³ΠΎ HTTP-Π·Π°ΠΏΡΠΎΡΠ° ΡΠ΅ΡΠ΅Π· Guzzle ΠΈ ReactPHP
- ΠΠ½Π΅Π΄ΡΠ΅Π½ΠΈΠ΅ Π·Π°Π²ΠΈΡΠΈΠΌΠΎΡΡΠ΅ΠΉ Ρ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΠ΅ΠΌ PHP-DI
βοΈ Π£ΡΡΠ°Π½ΠΎΠ²ΠΊΠ°
Π£ΡΡΠ°Π½ΠΎΠ²ΠΈΡΡ Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΡ ΠΌΠΎΠΆΠ½ΠΎ Ρ ΠΏΠΎΠΌΠΎΡΡΡ Composer:
composer require gest/telegest
π ΠΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΠ΅/ΠΡΠΈΠΌΠ΅ΡΡ
π€ ΠΠΎΡ ΡΠ΅ΡΡΠ°Π½ΡΠ»ΡΡΠΎΡ ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΠΉ
$bot = new TGBot($token); $bot ->getUpdateHandler() ->attachCallable(UpdateType::Message, fn($message) => (new TGBotClient)->sendMessage($message)) ->handleUpdates() ->run();
π οΈ Π‘ΡΠ΅ΠΊ
ΠΠΈΠ±Π»Π΅ΠΎΡΠ΅ΠΊΠ°: ReactPHP, Guzzle, PHP-DI