PHPackages                             f4php/pechkin - 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. [API Development](/categories/api)
4. /
5. f4php/pechkin

ActiveLibrary[API Development](/categories/api)

f4php/pechkin
=============

Pechkin is a Telegram API wrapper and Bot for F4, a (really) lightweight web application framework

v0.0.8(1mo ago)00MITPHP

Since Feb 28Pushed 1mo agoCompare

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

READMEChangelogDependencies (10)Versions (9)Used By (0)

*ABOUT*

Pechkin is a Telegram API wrapper and Bot implementation, designed around the following concepts:

- Very flexible and rich mechanics for branching Bot logic
- Declarative configuration style
- Support for seamless session operations in default PHP style
- Native support for as many API data types and methods as possible
- Seamless F4 integration

**F4 routing integration**

```
  $bot = new Bot($token);

  $f4->addRoute(
    Route::post('/bot.json', function (): void {})
        // This will interrupt normal request processing
        // and return an empty 204 response on every Telegram webhook request
        ->before($bot->interceptWebhook(...)),
  );
```

**Simple Bot configuration**

```
new Bot($token)
    ->register(
        On::command('/start', function(Context $ctx): void {
            // ...
        }),
    );
```

**Advanced Bot configuration example**

```
new Bot($token)
    ->register(
        // Register handlers that do not require any grouping or special conditions
        On::command('/start', function(Context $ctx): void {
            $_SESSION['flow'] = 'my-flow';
        })
          // Handler-level middleware
          ->before(fn(Context $ctx): Context => $ctx->withUpdate(/*...*/))
          ->onException(Throwable::class, function(Throwable $e, Context $ctx) {
              // ...
          }),
        On::command(When::equals('/cancel'), function(Context $ctx): void {
            $_SESSION['flow'] = '';
            // $ctx->client->reply("Hey there!");
        }),

        // Flows are groups of handlers with common pre-condition
        Flow::when(fn(Context $context): bool =>
            $_SESSION['flow'] === 'my-flow'
        )
          // Flow-level middleware
          ->before(fn(Context $ctx): Context => $ctx->withUpdate(/*...*/))
          ->register(
              On::command(When::startsWith('/command2'), function(Context $ctx): void {
                  // ...
              })
                ->before(fn(Context $ctx) => $ctx->withClient(/*...*/)),
              On::command(When::oneOf(['/command3', '/command4']), function(Context $ctx): void {
                  // ...
              }),
              On::command(When::matches('~/command[5-7]~'), function(Context $ctx): void {
                  // ...
              }),
              On::default(function(Context $ctx): void {
                  //...
              }),
          )
          ->onException(Throwable::class, function(Throwable $e, Context $ctx) {
              // ...
          }),
    )
      ->onException(Throwable::class, function(Throwable $e, Context $ctx) {
          // ...
      });
```

**Sessions**

Sessions are supported and enabled by default. Each webhook call automatically gets a session keyed by context: private chats are keyed by user ID, groups/supergroups/channels by chat ID.

Session data is available in the conventional $\_SESSION global array. Sessions in Pechkin do not use cookies.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 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 ~5 days

Total

8

Last Release

45d ago

### Community

Maintainers

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

---

Top Contributors

[![etranger](https://avatars.githubusercontent.com/u/4062692?v=4)](https://github.com/etranger "etranger (60 commits)")

---

Tags

bottelegramf4

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/f4php-pechkin/health.svg)

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

###  Alternatives

[longman/telegram-bot

PHP Telegram bot

4.0k2.1M50](/packages/longman-telegram-bot)[telegram-bot-php/core

A PHP library that makes using Telegram Bot API much easier.

60293.1k](/packages/telegram-bot-php-core)[zelenin/telegram-bot-api

Telegram Bot API Client

5917.2k](/packages/zelenin-telegram-bot-api)[klev-o/telegram-bot-api

Simple and convenient object-oriented implementation Telegram bot API with php version ^7.4 support. You'll like it)

457.8k1](/packages/klev-o-telegram-bot-api)[telegramsdk/botapi

SDK for the Telegram Bot API.

234.0k1](/packages/telegramsdk-botapi)[klev-o/crypto-pay-api

Simple and convenient implementation of the Crypto Pay payment system (@CryptoBot)

205.1k](/packages/klev-o-crypto-pay-api)

PHPackages © 2026

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