1. Go to this page and download the library: Download tigris/telegram-bot-api 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/ */
tigris / telegram-bot-api example snippets
$httpClient = new \GuzzleHttp\Client();
$apiClient = new \Tigris\Telegram\ApiClient($httpClient);
$apiClient->setApiToken('CHANGEME');
$apiWrapper = new \Tigris\Telegram\ApiWrapper($apiClient);
// Get array of the \Tigris\Telegram\Types\Updates\Update
$updates = $apiWrapper->getUpdates([
'offset' => $this->offset,
]);
// Process received updates
foreach ($updates as $update) {
$this->offset = $update->update_id + 1;
$this->setLastOffset($this->offset);
$this->processUpdate($update);
}
$apiWrapper->setErrorHandler(function (\Exception $e) use ($logger) {
$logger->log($e);
});
php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.