PHPackages                             apboro/teletant - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. apboro/teletant

ActiveLibrary[Image &amp; Media](/categories/media)

apboro/teletant
===============

Telegram bot framework

1.5.3(3y ago)014MITPHPPHP ^7.4|^8

Since Mar 11Pushed 3y ago1 watchersCompare

[ Source](https://github.com/apboro/teletant)[ Packagist](https://packagist.org/packages/apboro/teletant)[ RSS](/packages/apboro-teletant/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (4)Used By (0)

Teletant Framework
==================

[](#teletant-framework)

###### Authors: [@askoldex](https://t.me/monarkhov), [@uniqkic](https://t.me/uniqkic)

[](#authors-askoldex-uniqkic)

###### Inspiration: [telegraf](https://github.com/telegraf/telegraf), [irazasyed/telegram-bot-sdk](https://github.com/irazasyed/telegram-bot-sdk)

[](#inspiration-telegraf-irazasyedtelegram-bot-sdk)

Examples
--------

[](#examples)

[Click](https://github.com/askoldex/teletant-examples)

Getting Started
---------------

[](#getting-started)

#### Requirements

[](#requirements)

1. PHP 8.2
2. Composer

#### Installation

[](#installation)

`composer require askoldex/teletant`

#### Usage

[](#usage)

```
require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';

use Askoldex\Teletant\Bot;
use Askoldex\Teletant\Context;
use Askoldex\Teletant\Settings;

$settings = new Settings('token');
$settings->setHookOnFirstRequest(false);
$bot = new Bot($settings);
```

#### Run as long poll (getUpdates)

[](#run-as-long-poll-getupdates)

```
$bot->polling();
```

#### Run as webhook (listen webhook address)

[](#run-as-webhook-listen-webhook-address)

```
$bot->listen();
```

#### Fast Examples:

[](#fast-examples)

##### Making command

[](#making-command)

```
$bot->onCommand('start', function (Context $ctx) {
    $ctx->reply('Hello world');
});
```

##### [Message](https://core.telegram.org/bots/api#message) field handler

[](#message-field-handler)

```
$bot->onMessage('sticker', function (Context $ctx) {
    $ctx->reply('Nice sticker!');
});
```

##### [Update](https://core.telegram.org/bots/api#update) field handler

[](#update-field-handler)

```
$bot->onUpdate('message', function (Context $ctx) {
    $ctx->reply('Answer on any message (text, sticker, photo, etc.)');
});
```

##### [CallbackQuery](https://core.telegram.org/bots/api#callbackquery) "data" field handler

[](#callbackquery-data-field-handler)

```
$bot->onAction('like', function (Context $ctx) {
    $ctx->reply('You pressed the button with callaback_data=like');
});
```

##### Find substring in Message text

[](#find-substring-in-message-text)

```
$bot->onHears('fu*k', function (Context $ctx) {
    $ctx->reply('Stop! If you continue, you will be banned');
});
```

***Or use array substrings***

```
$bot->onHears(['di*k', 'f**k'], function (Context $ctx) {
    $ctx->reply('Stop! If you continue, you will be banned');
});
```

##### Making command with parameters

[](#making-command-with-parameters)

```
$bot->onText('/message {user:integer} {message:string}', function (Context $ctx) {
    $ctx->withVars()->reply("User id: {v-user}\nMessage: {v-message}");
});
```

> Parameter without validation type syntax: {name}
> Optional parameter without validation type syntax: {name?}
> Parameter syntax: {name:validator\_name}
> Optional parameter syntax: {name:validation\_name?}\\
>
> If you need &gt;2 spaced parameters. For example:
> /msg {a:string} {b:string}. If message text will be "/msg hello world guys". Variable values will be: a = hello world, b = guys).
> To explicitly separate variables you need to use Boxed variables:
> Syntax: {name:string:box}
> Example: /msg {name:string:"} {msg:string:"}
> In result you getcommand with syntax:
> /msg "{name:string}" "{msg:string}"
> Example: /msg "John Smith" "hello world"
> Variables: name=John Smith, msg=hello world.
> Boxed variable may be optional, syntax: {name:type:box?}

***Default validation types***

ValidatorPatterninteger\[\\d\]+float-?\\d+(.\\d+)?string\[\\w\\s\]+word\[\\w\]+char\[\\w\]any(.\*?)> Validator "any" used as default ({name} == {name:any})

EventArgument supportingonStartNOonPollNOonPollAnswerNOonDiceNOonTextYESonActionYESonHearsYESonCommandNOonMessageNOonUpdateNOonInlineQueryYES

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

1155d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f4b639c2c826265120c82e4a9bfe387b41f78095046f0d91da0664a90e42e54d?d=identicon)[AlexBoro](/maintainers/AlexBoro)

---

Top Contributors

[![apboro](https://avatars.githubusercontent.com/u/30046232?v=4)](https://github.com/apboro "apboro (10 commits)")

---

Tags

phpaudiovideofilesbottelegramstickerstelebotteletant

### Embed Badge

![Health badge](/badges/apboro-teletant/health.svg)

```
[![Health](https://phpackages.com/badges/apboro-teletant/health.svg)](https://phpackages.com/packages/apboro-teletant)
```

###  Alternatives

[danog/madelineproto

Async PHP client API for the telegram MTProto protocol.

3.4k855.0k18](/packages/danog-madelineproto)[askoldex/teletant

Telegram bot framework

221.0k](/packages/askoldex-teletant)[php-ffmpeg/php-ffmpeg

FFMpeg PHP, an Object Oriented library to communicate with AVconv / ffmpeg

5.0k21.7M163](/packages/php-ffmpeg-php-ffmpeg)[danog/tg-file-decoder

Decode Telegram bot API file IDs

75694.7k8](/packages/danog-tg-file-decoder)[opentok/opentok

OpenTok is a platform for creating real time streaming video applications, created by TokBox.

1413.0M10](/packages/opentok-opentok)[dereuromark/media-embed

A PHP library to deal with all those media services around, parsing their URLs and embedding their audio/video content in websites.

182530.3k11](/packages/dereuromark-media-embed)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
