2017 © Pedro Peláez
 

yii2-components yii2-telegram

Yii2 telegramm bot API wrapper based on Longman Telegram Bot

image

sem-soft/yii2-telegram

Yii2 telegramm bot API wrapper based on Longman Telegram Bot

  • Monday, February 12, 2018
  • by sem
  • Repository
  • 1 Watchers
  • 0 Stars
  • 58 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 21 % Grown

The README.md

Yii2 Telegramm Bot API wrapper based on Longman Telegram Bot

Install by composer

composer require sem-soft/yii2-telegram, (*1)

Or add this code into require section of your composer.json and then call composer update in console

"sem-soft/yii2-telegram": "*", (*2)

Usage

In configuration file do php <?php ... 'components' => [ ... 'filestorage' => [ 'telegram' => [ 'class' => \sem\telegram\TelegramBot::className(), 'apiKey' => '<уникальный_api_ключ>', 'botName' => '<имя_бота>', 'webhook' => 'https://<url_адрес_хука>' ] ] ... ], ... ?> ## Set webhook For this action try code, for exaple in console controller: ```php <?php /** * Файл класса-контроллера TelegramController * * @copyright Copyright (c) 2017, Oleg Chulakov Studio * @link http://chulakov.com/ */, (*3)

namespace console\controllers;, (*4)

use Yii;, (*5)

/** * Реализует настройку Telegram-бота */ class TelegramController extends \yii\console\Controller { /** * Устанавливает Webhook, по которому будет стучаться бот */ public function actionSet() { if (Yii::$app->telegram->setWebhook()) { $bot = Yii::$app->telegram->botName; echo "Webhook привязан к боту '{$bot}'\n";
} }, (*6)

/**
 * Удаляет Webhook, установленный ранее
 */
public function actionUnset()
{
    if (Yii::$app->telegram->unsetWebhook()) {
        $bot = Yii::$app->telegram->botName;
        echo "Webhook отвязан от бота '{$bot}'\n";
    }
}

}, (*7)

```, (*8)

The Versions

12/02 2018

dev-master

9999999-dev

Yii2 telegramm bot API wrapper based on Longman Telegram Bot

  Sources   Download

BSD-3-Clause BSD 3-Clause

The Requires

 

by Samsonov Vladimir

12/02 2018

1.0.1

1.0.1.0

Yii2 telegramm bot API wrapper based on Longman Telegram Bot

  Sources   Download

BSD-3-Clause

The Requires

 

by Samsonov Vladimir

02/10 2017

1.0.0

1.0.0.0

Yii2 telegramm bot API wrapper based on Longman Telegram Bot

  Sources   Download

BSD 3-Clause

The Requires

 

by Samsonov Vladimir