1. Go to this page and download the library: Download estaheri/easytel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
estaheri / easytel example snippets
use EasyTel\Telegram;
$tg = new Telegram($bot_token,$updates,$botapi_url,$request_method,$guzzle_client_options,$output);
#---------------------------------------------------------------------------------
$bot_token = '123456789:xxxxxxxxxxxxxxxx'; // Telegram bot token (You can get it from @botfather)
$updates = file_get_contents('php://input'); // (Optional) Pure telegram webhook updates you can use any method you want to getting updates
$botapi_url = 'https://api.telegram.org'; // (Optional) Your bot api url https://core.telegram.org/bots/api#using-a-local-bot-api-server (Mostly use telegram official server)
$request_method = 'POST'; // (Optional) Request method of http requests sends to telegram bot api url, Can be POST or GET
$guzzle_client_options = ['verify' => false]; // (Optional) Your custom guzzlehttp client options https://docs.guzzlephp.org/en/stable/request-options.html
$output = Telegram::OUTPUT_ARRAY; // (Optional) Output result of your requests send and received by telegram when using methods
use \EasyTel\Types\ReplyParameters;
# ------------------------- Methods -------------------------
$methods = $tg->methods; // Access to all telegram methods
$methods->sendMessage($chat_id, $text)
->parse_mode('markdown')
->reply_parameters(ReplyParameters::make($message_id, $chat_id));
# ------------------------- Updates -------------------------
$updates = $tg->updates; // Access to all webhook updates received
// IDE will suggest every property you see here because of full structured properties from their classes
$message = $updates->message;
$chat_id = $message->chat->id;
$message_id = $message->message_id;
$text = $message->text;
$reply_text = $message->reply_to_message->text;