PHP code example of goodway / hypervel-telegram

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

    

goodway / hypervel-telegram example snippets


use Telegram\Bot\Hypervel\Facades\Telegram;

$response = Telegram::sendMessage([
	'chat_id' => 'CHAT_ID',
	'text' => 'Hello World'
]);

$messageId = $response->getMessageId();

use Telegram\Bot\Hypervel\Facades\Telegram;
use Telegram\Bot\Keyboard\Keyboard;
use Telegram\Bot\Keyboard\Button;

$buttons = [
     new Button()->setText('Button 1')->setCallbackData('btn1_callback'),
     new Button()->setText('Button 2')->setCallbackData('btn2_callback'),
];

$keyboard = new Keyboard()->inline()->row($buttons);
$replyMarkup = json_encode($keyboard->toArray());
        
$response = Telegram::sendMessage([
    'chat_id' => 'CHAT_ID',
    'text' => 'Hello World',
    'parse_mode' => 'MarkdownV2',
    'reply_markup' => $replyMarkup,
]);

$messageId = $response->getMessageId();

php artisan vendor:publish "Telegram\Bot\Hypervel\TelegramServiceProvider"