Download the PHP package zarincheg/telegram-bot-dialogs without Composer

On this page you can find all versions of the php package zarincheg/telegram-bot-dialogs. 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?

Informations about the package telegram-bot-dialogs


⚠️ NOT SUPPORTED, HERE IS MAINTAINING FORKS:

https://github.com/koot-labs/telegram-bot-dialogs


telegram-bot-dialogs

The extension for Telegram Bot API PHP SDK that allows to implement dialogs in bots

This libriary allows to make simple dialogs for your Telegram bots that based on the Telegram Bot API - PHP SDK (https://github.com/irazasyed/telegram-bot-sdk).

Installation

You can easy install the package using Composer:

composer require zarincheg/telegram-bot-dialogs dev-master

After that you need to register the service provide for using with Laravel DI container Open config/app.php and, to your providers array at the bottom, add:

Each dialog should be implemented as class that extends basic Dialog as you can see in example bellow:

For initiate new dialog you have to use Dialogs class instance to add new dialog implementation. And for execute the first and next steps you have to call Dialogs::procceed() mehod with update object as an argument. Also it is possible to use dialogs with Telegram commands and DI through type hinting.

And code in the webhook controller

For storing dialog information(also for the data that pushed by the Dialog::remember() method) using Redis.

Advanced definition of the dialog steps

You can define default text answers for your dialog steps. For this you have to define the step as an array with name and response fields.

In this case, if you don't need any logic inside the step handler - you can don't define it. Just put the response inside the step definition. It works good for welcome messages, messages with tips/advices and so on. If you want format response with markdown, just set markdown field to true.

Also, you can control dialog direction in step by defining jump and end fields. jump acts as jump() method - dialog jumps to particular step. end field, is set to true, ends dialog after current step.

Also, you can use is_dich (is it a dichotomous question) option of the step. If this option set to true, you can use yes and no fields of the Dialog instance to check user answer. For example:

In the config/dialogs.php you can modify aliases for yes/no meanings.

Often in dichotomous question you only need to send response and jump to another step. In this case, you can define steps with responses and set their names as values of 'yes', 'no' or 'default' keys of dichotomous step. For example:

Access control with in dialogs

You can inherit AuthorizedDialog class and put Telegram usernames into $allowedUsers property. After that just for users in the list will be allowed to start the dialog.

Available methods of the Dialog class

Available methods of the Dialogs class

Steps configuration in separate files

You can define dialog configuration in separate yaml or php files. To do this, set scenarios in dialogs configuration file, using dialog class name as key and path to config file as value, for example:

Configuration from files in production environment stored in default cache instanse. Because of this, you shall add php artisan cache:clear to your deployment script.

What is planned to improve:


All versions of telegram-bot-dialogs with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.9
illuminate/support Version ^5.2
irazasyed/telegram-bot-sdk Version ^2.0
illuminate/redis Version ^5.2
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 zarincheg/telegram-bot-dialogs contains the following files

Loading the files please wait ....