1. Go to this page and download the library: Download aqjw/tele-step-handler 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/ */
aqjw / tele-step-handler example snippets
namespace App\Telegram\Steps;
use Aqjw\TeleStepHandler\TeleStepHandlerAbstract;
use Aqjw\TeleStepHandler\Steps\TeleStepCommand;
use Aqjw\TeleStepHandler\Steps\TeleStepButton;
class MainSteps extends TeleStepHandlerAbstract
{
public function handler()
{
return [
new TeleStepCommand('/start', function () {
$this->bot->sendMessage([
'text' => 'This is start command',
'reply_markup' => [
'inline_keyboard' => [[['text' => 'Do something', 'callback_data' => 'do_something']]]
]
]);
return true; // stop checking other steps
}),
new TeleStepButton('do_something', function () {
$this->bot->sendMessage(['text' => 'Something did']);
return true; // stop checking other steps
}),
];
}
public function trigger($args)
{
return true;
}
}