PHP code example of kolirt / laravel-telegram

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

    

kolirt / laravel-telegram example snippets


$config->bot('test')
    ->commands(function (CommandBuilder $builder) {
        $builder->start(StartCommand::class, 'Start command description');
        $builder->command('info', InfoCommand::class, 'Info command description');
        $builder->command('test', [TestCommand::class, 'index'], 'Test command description');
    })

$config->bot('tma')
    ->keyboard(function (KeyboardBuilder $keyboard) {
        $keyboard->defaultHandler(StartCommand::class);
        // OR
        $keyboard->defaultHandler(HomeController::class);
    });
bash
php artisan telegram:install

php artisan migrate

php artisan telegram:bot-create {bot-name} {token}