A framework for building Telegram bots with an Android-inspired architecture: Activities, Intents, ViewModels, lifecycles, and a navigation back stack — plus Doctrine, cache/Redis, plugin, and automatic migration support.

Quick Start

Install

Install the package and boot the Kernel in your entry point.

composer require aicrion/tandroid

Send a message

A fluent facade for every Bot API method.

Telegram::message()
  ->to($chatId)
  ->text('Hello from Aicrion')
  ->send();

Core Architecture

Kernel

Boots the Container, discovers plugins, runs automatic migrations, connects Telegram, and routes Updates.

Activity

A screen-like unit of interaction, with onCreate/onResume/onPause and NavigationRequest chaining.

ViewModel

Holds structured state across multiple Activities, persisted in the StateStore (cache).

API Reference (Summary)

AreaSample methodsUse case
Messagingmessage, edit, message_ (forward/copy)Core conversation flow
Mediaphoto, video, document, mediaGroupSending rich content
Administrationchat, inviteLinks, forumGroup/channel management
Paymentsinvoice, preCheckout, starTransactionsSelling digital goods
Inlineinline, webApp, guestQueryCross-chat interactions

The complete, exact table is in the full Telegram API reference.

Widgets

FormWidget

A linear multi-step form with validation and state recovery.

WizardWidget

Multiple pages with explicit Previous/Next buttons.

RichMessage

Tables, quotes, code blocks, maps, and slideshows.

CheckboxGroupWidget

A multi-select checkbox group, stateless between taps.

Full details in Views and Widgets.

Testing

Unit tests cover Intent, Translator, ViewModel, and ActivityManager's navigation chain, plus an overall project health smoke test.

vendor/bin/phpunit

Full testing guide in Testing.

Deployment

A step-by-step guide for deploying to shared hosting (no CLI) and VPS/Docker is in Deployment.