PHP code example of franchuk / simple-telegram-client

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

    

franchuk / simple-telegram-client example snippets



use SimpleTelegramBotClient\Config;
use SimpleTelegramBotClient\TelegramServiceFactory;

ate($config);


use SimpleTelegramBotClient\Config;
use SimpleTelegramBotClient\TelegramService;
use GuzzleHttp\Client;
use JMS\Serializer\SerializerBuilder;

izerBuilder::create()->build();

$telegramService = new TelegramService($config, new Client(), $serializer);


$telegramService->getUpdates();


use SimpleTelegramBotClient\Builder\Action\SendMessageBuilder;

$chatId = '1234';
$sendMessageBuilder = new SendMessageBuilder($chatId, 'Hello World!');
$message = $sendMessageBuilder->build();
$telegramService->sendMessage($message);


use SimpleTelegramBotClient\Config;

$config = new Config('some key');
$config->setProxy('socks4://ip:port');