dev-master
9999999-devbot for telegram
BSD-3-Clause
The Requires
by Jasur Mirkhamidov
extension yii2 bot telegram
bot for telegram
The preferred way to install this extension is through composer., (*1)
Either run, (*2)
php composer.phar require mirkhamidov/yii2-bot-telegram "*"
or add, (*3)
"mirkhamidov/yii2-bot-telegram": "*"
to the require section of your composer.json
file., (*4)
first add to config.php, (*5)
<?php 'components' => [ 'telegram' => [ 'class' => 'mirkhamidov\telegramBot\TelegramBot', 'botToken' => 'TOKEN HERE', ] ] ?>
Once the extension is installed, simply use it in your code by :, (*6)
<?php Yii::$app->telegram->sendMessage('Message'); ?>
send message width inline keyboard by:, (*7)
<?php Yii::$app->telegram->sendMessage('Message with inline keyboard', $chatId, [ 'reply_markup' => json_encode([ 'inline_keyboard'=>[ [ ['text'=>"refresh",'callback_data'=> time()] ] ] ]), ] ?>
send photo by :, (*8)
<?php Yii::$app->telegram->sendPhoto('/app/pattern2.jpg', $chatId, [ 'caption' => 'some text', ]); ?>
PS: Inspired by aki/yii2-bot-telegram, (*9)
bot for telegram
BSD-3-Clause
extension yii2 bot telegram