Yii 2.0: bot-telegram

For send message in telegram
1 follower

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require aki/yii2-bot-telegram "*"

or add

"aki/yii2-bot-telegram": "*"

to the require section of your composer.json file.

Usage

frist add to config.php

<?php
'component' => [
    'telegram' => [
           'class' => 'aki\telegram\Telegram',
           'botToken' => '123456:a1dfco12er3b5yuh',
           'botUsername' => 'PostManGoBot'
    ]
 
]
?>

Once the extension is installed, simply use it in your code by :

<?= Yii::$app->telegram->sendMessage([
   'chat_id' => 'this is test message'
]); ?>

Resources

Be the first person to leave a comment

Please to leave your comment.

Create extension
Downloads
No downloadable files yet