Download the PHP package tourze/telegram-bot-bundle without Composer
On this page you can find all versions of the php package tourze/telegram-bot-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tourze/telegram-bot-bundle
More information about tourze/telegram-bot-bundle
Files in tourze/telegram-bot-bundle
Package telegram-bot-bundle
Short Description Telegram 机器人 Symfony Bundle,提供完整的机器人开发功能
License MIT
Informations about the package telegram-bot-bundle
TelegramBotBundle
中文
A Symfony bundle for managing Telegram bots, providing comprehensive bot management capabilities including:
- Bot creation, editing, and management
- Webhook message reception
- Auto-reply rule management
- Message processing and sending
- Command handling system
Table of Contents
- Features
- Installation
- Quick Start
- Auto-Reply Rules
- Command Handling
- Event System
- API
- Advanced Usage
- License
Features
🤖 Bot Management
- Create and manage multiple Telegram bots
- Set up webhook URLs automatically
- Bot validation and status tracking
- Comprehensive bot configuration options
📨 Message Processing
- Receive and process webhook messages
- Support for all Telegram message types
- Message persistence and tracking
- Real-time message handling
🎯 Auto-Reply System
- Rule-based automatic replies
- Exact and fuzzy text matching
- Priority-based rule processing
- HTML-formatted response support
⚡ Command System
- Extensible command handling framework
- Custom command handlers
- Argument parsing and validation
- Built-in system commands
📊 Analytics & Logging
- Command execution logging
- Message tracking and statistics
- User interaction analytics
- System monitoring capabilities
Installation
Requirements
- PHP 8.1 or higher
- ext-json
- Symfony 7.3 or higher
- Doctrine ORM 3.0+
- Doctrine DBAL 4.0+
- EasyAdmin Bundle 4+
Install via Composer
Core Dependencies
doctrine/orm: ^3.0doctrine/dbal: ^4.0doctrine/doctrine-bundle: ^2.13symfony/framework-bundle: ^7.3symfony/http-client-contracts: ^3.6easycorp/easyadmin-bundle: ^4- Plus additional Tourze bundles for enhanced functionality
Quick Start
1. Bundle Registration
Register the bundle in your config/bundles.php:
2. Basic Configuration
The bundle works out-of-the-box without additional configuration files. The webhook endpoint is automatically available at:
For advanced configuration, you can customize services in your config/services.yaml if needed.
3. Usage
-
Run database migrations to create required tables:
-
Access the EasyAdmin interface to manage bots:
- Bots:
/admin?crudAction=index&crudControllerFqcn=TelegramBotBundle\Controller\Admin\TelegramBotCrudController - Auto-Reply Rules:
/admin?crudAction=index&crudControllerFqcn=TelegramBotBundle\Controller\Admin\AutoReplyRuleCrudController - Bot Commands:
/admin?crudAction=index&crudControllerFqcn=TelegramBotBundle\Controller\Admin\BotCommandCrudController
- Bots:
- Set up webhook URLs using the console command:
Auto-Reply Rules
Create intelligent auto-reply rules through the admin interface:
- Exact Matching: Messages must match the keyword exactly
- Fuzzy Matching: Messages containing the keyword will trigger replies
- Priority System: Higher priority rules (larger numbers) are processed first
- HTML Support: Reply content supports HTML formatting
- Per-Bot Rules: Each bot can have its own set of rules
Command Handling
The bundle provides a command handling system that allows easy addition of new command handlers:
-
Create a command handler class:
- Command handlers will be automatically registered and handle corresponding commands
Event System
The bundle uses an event system to handle Webhook messages. You can create your own EventSubscriber to handle messages:
API
Sending Messages
Advanced Usage
Database Schema
The bundle creates several tables for managing bots and tracking activity:
tg_bot: Bot configuration (name, token, webhook URL)tg_auto_reply_rule: Auto-reply rules with priority and matching optionstelegram_bot_command: Custom command definitionstelegram_update: All received Telegram updates (with Snowflake IDs)command_log: Command execution audit trail
Event-Driven Architecture
Monitor bot activity by subscribing to events:
Custom Message Handlers
Create sophisticated message processing by implementing custom handlers:
Custom Command Handlers
Implement the CommandHandlerInterface to create custom commands:
Register your handler in the admin interface by creating a BotCommand entry with your handler's FQCN.
Contributing
We welcome contributions to improve this bundle! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes and add tests
- Ensure all tests pass (
./vendor/bin/phpunit packages/telegram-bot-bundle/tests) - Run static analysis (
php -d memory_limit=2G ./vendor/bin/phpstan analyse packages/telegram-bot-bundle) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development Setup
Changelog
Latest Changes
- Enhanced test coverage with comprehensive integration tests
- Improved PHPStan compliance and type safety
- Added support for all Telegram message types
- Implemented robust command parsing and logging
- Enhanced EasyAdmin integration for better management
Version History
- v0.1.x: Core bot management and webhook handling
- v0.2.x: Auto-reply system and command framework
- v0.3.x: Enhanced logging and event system
- Current: Full-featured bot development platform
License
This bundle is licensed under the MIT License. See the LICENSE file for details.
Reference Documentation
All versions of telegram-bot-bundle with dependencies
doctrine/data-fixtures Version ^2.0
doctrine/dbal Version ^4.0
doctrine/doctrine-bundle Version ^2.13
doctrine/doctrine-fixtures-bundle Version ^4.0
doctrine/orm Version ^3.0
doctrine/persistence Version ^4.1
easycorp/easyadmin-bundle Version ^4
knplabs/knp-menu Version ^3.7
monolog/monolog Version ^3.1
psr/log Version ^3|^2|^1
symfony/config Version ^7.3
symfony/console Version ^7.3
symfony/dependency-injection Version ^7.3
symfony/doctrine-bridge Version ^7.3
symfony/event-dispatcher Version ^7.3
symfony/event-dispatcher-contracts Version ^3
symfony/framework-bundle Version ^7.4
symfony/http-client Version ^7.3
symfony/http-client-contracts Version ^3.6
symfony/http-foundation Version ^7.4
symfony/http-kernel Version ^7.3
symfony/property-access Version ^7.3
symfony/routing Version ^7.3
symfony/yaml Version ^7.3
tourze/arrayable Version 1.*
tourze/bundle-dependency Version 1.*
tourze/doctrine-async-insert-bundle Version 1.0.*
tourze/doctrine-indexed-bundle Version 1.0.*
tourze/doctrine-snowflake-bundle Version 1.1.*
tourze/doctrine-timestamp-bundle Version 1.1.*
tourze/doctrine-track-bundle Version 1.1.*
tourze/doctrine-user-bundle Version 1.0.*
tourze/easy-admin-menu-bundle Version 1.0.*
tourze/redis-dedicated-connection-bundle Version 1.0.*
tourze/symfony-dependency-service-loader Version 1.0.*
tourze/symfony-routing-auto-loader-bundle Version 1.0.*
tourze/symfony-snowflake-bundle Version 1.0.*