PHP code example of miqdadyyy / laraveltelegrambot

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

    

miqdadyyy / laraveltelegrambot example snippets


$result = LaravelTelegramBot::getId()

$result = LaravelTelegramBot::getUpdates()

$message = LaravelTelegramBot::createMessage($chat_id, $text, $options);

$message->send();

LaravelTelegramBot::sendMessage($chat_id, $text, $options);

$inline_keyboard = new InlineKeyboard();

$row1 = new InlineKeyboardRow();
$inline_keyboard->addRow($row);

$row->addButton($title, $callback);

$inline_keyboard = new InlineKeyboard(); // create inline keyboard

$row1 = new InlineKeyboardRow(); // create first row
$row1->addButton('Say Hello Juga', 'http://www.example.com'); // add first button on first row
$row1->addButton('Say Hello Juga 2', 'callback_query'); // add second button on first row
$inline_keyboard->addRow($row); // add row to inline keyboard

// There are a method to add a single button to inline keyboard
$inline_keyboard->addSingleLineButton('Say Hello Juga 3', 'i dont know what');

// then add keyboard to a message
$message->addInlineKeyboard($inline_keyboard);
$message->send(); // send message to user

$message->addSingleInlineButton('Hello', 'http://miqdad.codes');
// then send the message
$message->send();

$keyboard = [
    ['Hello'],
    ['Help', 'Login']    
];
// set keyboard button from array
$message->setKeyboardButton($keyboard);
// send the messagee
$message->send();
bash
php artisan telegrambot:webhook --option=remove