How tueen/telegram works
Tueen Telegram is a modern PHP SDK for building Telegram bots. A bot is configured, run through polling or webhook intake, and incoming updates are decoded and dispatched to registered routes or conversational flows; handlers use typed API methods to send requests through the HTTP client. The SDK also provides typed models, formatting and keyboard builders, resilient middleware, app/dashboard tooling, and test fakes. Some subsystem links are documented capabilities rather than inspected call sites, so those edges cite the README.
Main entry points: Telegram.php Bot facade · TelegramClient.php API client · Method.php Typed API methods · HttpClientInterface.php HTTP transports
Components 22
Bot runtime
- Bot facade
src/Telegram.php - Configuration
src/Config.php - Polling and webhook
src/Running - Typed updates
src/Types/Update.php - Update routing
src/Routing/Router.php - Handler context
src/Context/ContextResolver.php - Update dispatcher
src/Dispatcher/UpdateDispatcher.php
Telegram API
- Typed API methods
src/Methods/Method.php - Typed data models
src/Types/Type.php - API client
src/Client/TelegramClient.php - HTTP transports
src/Client/HttpClientInterface.php
Bot interaction
- Conversational flows
src/Flow/FlowManager.php - Flow state stores
src/Flow/Storage - Formatting and keyboards
src/Formatting/Text.php
App tooling
- Zero-config app
src/App.php - Web dashboard
src/App/WebDashboard.php
Resilience and testing
- HTTP middleware
src/Pipeline/Pipeline.php - Typed error handling
src/Enums/TelegramErrorCode.php - Testing fakes
src/Testing/TelegramFake.php
Other components
- Bot developer
- Telegram users
- Telegram Bot API
Connections 22
- Bot developer → Bot facade: configures and runs
README.md - Telegram users → Polling and webhook: sends updates
README.md - Polling and webhook → Bot facade: delivers updates
src/Running/WebhookMode.php - Bot facade → Typed updates: decodes payload
src/Telegram.php - Bot facade → Update dispatcher: dispatches updates
src/Telegram.php - Update dispatcher → Update routing: routes updates
- Update routing → Handler context: resolves handler arguments
- Bot facade → Conversational flows: starts and manages
src/Telegram.php - Conversational flows → Flow state stores: reads and writes state
src/Flow/FlowManager.php - Bot developer → Typed API methods: calls bot methods
README.md - Typed API methods → API client: executes method
src/Client/TelegramClient.php - API client → HTTP transports: sends requests
src/Client/TelegramClient.php - HTTP transports → Telegram Bot API: calls API
src/Client/HttpClientInterface.php - Telegram Bot API → HTTP transports: returns response
- API client → Typed error handling: maps API errors
src/Client/TelegramClient.php - Typed API methods → Typed data models: uses typed values
src/Methods/Method.php - Bot developer → Formatting and keyboards: builds messages
README.md - Bot developer → Zero-config app: launches bot
README.md - Zero-config app → Web dashboard: serves dashboard
src/App.php - Bot facade → Configuration: uses settings
src/Telegram.php - API client → HTTP middleware: applies middleware
src/Client/TelegramClient.php - Bot developer → Testing fakes: tests bot behavior
README.md