PHP code example of rezident / self-documented-telegram-bot-sdk
1. Go to this page and download the library: Download rezident/self-documented-telegram-bot-sdk 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/ */
rezident / self-documented-telegram-bot-sdk example snippets
use Rezident\SelfDocumentedTelegramBotSdk\components\Executor;
use Rezident\SelfDocumentedTelegramBotSdk\methods\GettingUpdates\GetUpdatesMethod;
$executor = new Executor('8360528562:Eim2eitahSh3ohshi7zee2Hoh2gaewee6eV');
$updates = GetUpdatesMethod::new()->exec($executor);
foreach ($updates as $update) {
echo $update->getMessage()->getText();
}
use Rezident\SelfDocumentedTelegramBotSdk\components\Executor;
use Rezident\SelfDocumentedTelegramBotSdk\methods\GettingUpdates\GetUpdatesMethod;
$executor = new Executor('8360528562:Eim2eitahSh3ohshi7zee2Hoh2gaewee6eV');
$sentMessage = SendMessageMethod::new(8376498, 'Hello my dear friend!')->exec($executor);
...