PHP code example of alexvkokin / telegram-bot-api

1. Go to this page and download the library: Download alexvkokin/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/ */

    

alexvkokin / telegram-bot-api example snippets


use Alexvkokin\TelegramBotApi\Client\TelegramClient;
use Alexvkokin\TelegramBotApi\Method\SendMessage;
use Alexvkokin\TelegramBotApi\Method\SendPhoto;
use Alexvkokin\TelegramBotApi\Method\GetMe;
use Alexvkokin\TelegramBotApi\TelegramBotApi;
use Alexvkokin\TelegramBotApi\Type\InputFile;
use GuzzleHttp\Client;
use HttpSoft\Message\RequestFactory;
use HttpSoft\Message\StreamFactory;

lo, world!',
);
$response = $api->send($method);

// send local file
$method = new SendPhoto(
    chat_id: $chatId,
    photo: InputFile::withLocalFile(__DIR__.'/../imgs/screen.png', 'screenshot 1'),
);
$response = $api->send($method);