Download the PHP package onmotion/yii2-telegram without Composer

On this page you can find all versions of the php package onmotion/yii2-telegram. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?
onmotion/yii2-telegram
Rate from 1 - 5
Rated 4.00 based on 1 reviews

Informations about the package yii2-telegram

Telegram support Bot for Yii2

Latest Stable Version Total Downloads License Daily Downloads Monthly Downloads

Support chat for site based on Telegram bot

The Bot logic based on akalongman/php-telegram-bot, so you can read Instructions by longman how to register Telegram Bot and etc.

Now only telegram webhook api support. You need SSL cert! Doesn't work on http!

Installation

The preferred way to install this extension is through composer.

Run

composer require onmotion/yii2-telegram

add to your web config:

 'modules' => [
     //...
    'telegram' => [
        'class' => 'onmotion\telegram\Module',
        'API_KEY' => 'forexample241875489:AdfgdfFuVJdsKa1cycuxra36g4dfgt66',
        'BOT_NAME' => 'YourBotName_bot',
        'hook_url' => 'https://yourhost.com/telegram/default/hook', // must be https! (if not prettyUrl https://yourhost.com/index.php?r=telegram/default/hook)
        'PASSPHRASE' => 'passphrase for login',
        // 'db' => 'db2', //db file name from config dir
        // 'userCommandsPath' => '@app/modules/telegram/UserCommands',
        // 'timeBeforeResetChatHandler' => 60
    ]
    //more...
 ]

and to console config:

 'bootstrap' => [   
 //other bootstrap components...
                'telegram'],
 'modules' => [
         //...
     'telegram' => [
         'class' => 'onmotion\telegram\Module',
         'API_KEY' => 'forexample241875489:AdfgdfFuVJdsKa1cycuxra36g4dfgt66',
         'BOT_NAME' => 'YourBotName_bot',
     'hook_url' => 'https://yourhost.com/telegram/default/hook', // must be https! (if not prettyUrl https://yourhost.com/index.php?r=telegram/default/hook)
         'PASSPHRASE' => 'passphrase for login',
     ]
 ],       

run migrations:

php yii migrate --migrationPath=@vendor/onmotion/yii2-telegram/migrations #that add 4 tables in your DB

or add to your config file

and run

go to https://yourhost.com/telegram/default/set-webhook (if not prettyUrl https://yourhost.com/index.php?r=telegram/default/set-webhook)

Now you can place where you want

echo \onmotion\telegram\Telegram::widget(); //that add chat button in the page

in bottom right corner you can see:

chat button

if you click it:

client chat

and server side:

client chat

If you want to limit the storage period of messages history, add to you crontab:

#leave 5 days (if empty - default = 7)
php yii telegram/messages/clean 5

Also you can use custom commands. To do this, you can copy UserCommands dir from /vendor/onmotion/yii2-telegram/Commands and add path to this in config, for example:

'userCommandsPath' => '@app/modules/telegram/UserCommands'

timeBeforeResetChatHandler - the number of minutes before chat handler will be killed (if he forgot do /leavedialog). Never kill if 0 or not setted.


All versions of yii2-telegram with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
yiisoft/yii2 Version >=2.0.1
longman/telegram-bot Version ^0.35.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package onmotion/yii2-telegram contains the following files

Loading the files please wait ....