Download the PHP package mateodioev/tg-handler without Composer

On this page you can find all versions of the php package mateodioev/tg-handler. 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 tg-handler

Telegram bot handler

Installation

Usage

Create new instance and add your command

Creating new command instance

All text commands need to extend Mateodioev\TgHandler\Commands\MessageCommand class, and put the logic in the method handle.

This command works with /start any text here or /start. If you need another prefixes (/, !) you can add with method addPrefix or with property prefix

Using middlewares

You can add middlewares to your command. Middlewares are closures that will be executed before the command. All middlewares results will be passed to the command as an array.

For example, you can create a middleware that will check if the user is authorized, and if not, the command will not be executed.

You can use StopCommand exception to stop command execution

Using filters

Now you can set custom filters to you event for validate, all filters need to extends the interface Mateodioev\TgHandler\Filters\Filter

Now this command only respond to the user ID 996202950

Using multiple filters

You can use FilterCollection

Or can use this sintax

Conversations

To start a new conversation you simply return an instance of the Mateodioev\TgHandler\Conversations\Conversations in a interface of Mateodioev\TgHandler\Events\EventInterface

Conversation:

EventInterface handler for this case an instance of MessageCommand

Register the conversation

For more details see examples folder

Loging

Basic usage

Collections of streams

Set log level

Use

The logger can be used from the bot or event instances (MessageCommand, CallbackCommand, etc)

Bot:

Event instances:

Manager errors

You can register an exception handler the will be used if an exception occurs within the Events::execute method method or in the event middlewares


All versions of tg-handler with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
psr/log Version ^3.0
smoren/string-formatter Version ^1.0
mateodioev/string-vars Version ^1.2
mateodioev/tgbot Version ^v4.2
kombyte/simple-logger Version ^1.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 mateodioev/tg-handler contains the following files

Loading the files please wait ....