laraxgram / laraquest
Sending requests and receiving Telegram updates.
v1.0.0
2025-02-12 15:59 UTC
Requires
- ext-curl: *
README
Sending requests and receiving Telegram updates.
- Bot API Version
8.3
Other Versions
- Laraquest GoLang
- Laraquest Python
- Laraquest JavaScript
- Laraquest Rust
- Laraquest C#
Installation:
composer require laraxgram/laraquest
Config:
$_ENV["BOT_TOKEN"] = "123456789:ABcdEfGHigKLMnopQrStuvWXYZ"; // required $_ENV["BOT_API_SERVER"] = "https://api.telegram.org/"; // default-optional // Polling $_ENV["sleep_interval"] = 0.5; // default-optional $_ENV["timeout"] = 100; // default-optional $_ENV["limit"] = 100; // default-optional $_ENV["allow_updates"] = ["*"]; // default-optional
Usage:
Methods:
Just use trait Method in your class!
use LaraGram\Laraquest\Methode; class MyBotClass { use Methode; } $bot = new MyBotClass(); $bot->sendMessage(123456789, 'hello!');
Just use trait Updates in your class!
Updates:
use LaraGram\Laraquest\Updates; class MyBotClass { use Updates; } $bot = new MyBotClass(); $chatID = $bot->message->chat->id;
Both:
Just use trait Method and Updates in your class!
use LaraGram\Laraquest\Methode; use LaraGram\Laraquest\Updates; class MyBotClass { use Methode, Updates; } $bot = new MyBotClass(); $bot->sendMessage($bot->message->chat->id, 'hello!');
Long Polling
Laraquest::polling(function(Laraquest $request){ $request->sendMessage($request->message->chat->id, "Hello, Laraquest!") });