Download the PHP package vet1kk/telegram-bot-core without Composer
On this page you can find all versions of the php package vet1kk/telegram-bot-core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vet1kk/telegram-bot-core
More information about vet1kk/telegram-bot-core
Files in vet1kk/telegram-bot-core
Package telegram-bot-core
Short Description Lightweight Telegram Bot PHP Core Library
License MIT
Homepage https://github.com/vet1kk/telegram-bot-core
Informations about the package telegram-bot-core
Telegram Bot Core
Lightweight Telegram bot core for PHP 8.3+ with typed updates, attribute-based handlers, middleware, events, and a small DI-driven runtime.
It is designed for projects that want Telegram bot wiring without bringing in a full framework.
Highlights
- Strictly typed PHP 8.3 codebase
- Attribute-based commands, actions, and listeners
- Typed DTO tree for Telegram updates
- Middleware pipeline for cross-cutting behavior
- Event manager for decoupled side effects
- Inline and reply keyboard builders
- PSR-11 container support through
php-di/php-di - Covered by PHPUnit tests and Psalm static analysis
Requirements
- PHP
8.3+ - Extensions:
curl,json,mbstring - A Telegram bot token from @BotFather
- A public webhook URL for production webhook handling
Installation
Quick start
Create a webhook entrypoint and register your handlers. The library bootstraps its core services for you.
If you only need to register the webhook once:
Your first command
Commands handle Telegram messages such as /start.
Your first action
Actions handle callback_query updates from inline keyboard buttons.
Middleware
Middleware runs before the router dispatches an update and is useful for timing, auth, maintenance mode, or logging.
Event listeners
Listeners let you react to lifecycle events without coupling side effects to your handlers.
Built-in events include:
Bot\Event\Events\ReceivedEventBot\Event\Events\CommandHandledEventBot\Event\Events\ActionHandledEventBot\Event\Events\UnhandledEvent
Service providers and customization
The core runtime registers sensible defaults, including a NullLogger, webhook handler, client, router, managers, and
update factory. Override or extend them with your own service provider.
If you are integrating this library into Laravel, Symfony, Slim, or another HTTP stack, swapping
Bot\Webhook\WebhookHandlerInterface is usually the first extension point.
Running updates manually
For tests or custom transports, you can create an UpdateDTO and execute the pipeline directly with
Bot::run($update).
Bot::runFromWebhook() is just a convenience around reading the webhook payload, building the update DTO, emitting
ReceivedEvent, and routing the update through middleware.
Development commands
Quality snapshot
Current local quality snapshot for this repository:
- Psalm inferred types for
99.7207%of the codebase - PHPUnit suite:
106tests,240assertions - PHPUnit coverage:
98.17%lines,94.93%methods,85.37%classes
You can refresh these numbers locally with:
Project notes
- Namespace:
Bot\\ - License:
MIT - Homepage:
https://github.com/vet1kk/telegram-bot-core - Issue tracker:
https://github.com/vet1kk/telegram-bot-core/issues
Contributing
Issues and pull requests are welcome. If you add new features or integrations, please include tests where it makes sense so the public API stays reliable.
All versions of telegram-bot-core with dependencies
ext-curl Version *
ext-json Version *
ext-mbstring Version *
guzzlehttp/guzzle Version ^7.8
psr/container Version ^2.0
php-di/php-di Version ^7.1
psr/log Version ^3.0