PHP code example of michyaraque / simpletelegrambot

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

    

michyaraque / simpletelegrambot example snippets


$events = new EventLoader(Updates::userId(), Updates::language());
$events->setPath('example');
$events->forceEvents(['main.php', '__query_helpers.php']);
$events->getEvents();

Component::group('Example', function ($component) {
    $component->t();
});



namespace App\Components\Example;

use App\Models\Data;
use App\Components\Component;
use Telegram\{Client, Updates};

class InitialPanelsComponent extends Component {

    public static function start() {
        Client::sendMessage(Updates::userId(), "Example message");
    }

}

$inline_keyboard = new InlineKeyboard;
$inline_keyboard->inlineKeyboardButton('Button name', 'callback_identifier');
$inline_keyboard->endRow();

Client::sendMessage(Updates::userId(), "Example message", [
    'reply_markup' => $inline_keyboard->inlineKeyboardMarkup()
]);
bash
Events
   └── example
       ├── main.php
       └── __query_helpers.php
bash
Components
   ├── Example
   │   └── InitialPanelsComponent.php
   └── Component.php