-
Notifications
You must be signed in to change notification settings - Fork 0
Changelog
maule edited this page Aug 16, 2026
·
1 revision
All notable changes to TGbotPHP will be documented in this file.
Complete rewrite with PHP 8.4+ features and security hardening
- PHP 8.4 Support - Typed properties, named arguments, union types, match expressions, null-safe operators
- Security Hardening - Environment variable support, HTTPS enforcement, input validation
- Improved API - Named parameters for better readability
- Comprehensive Documentation - Wiki, API reference, examples, security guide
- Development Tools - PHPStan integration, Composer support, configuration management
- Better Error Handling - Structured error logging, resource management
- Type Safety - Full type hints throughout codebase
-
Breaking: Constructor now uses named arguments
// Old new botTG($token, $updates, true); // New new botTG(token: $token, updates: $updates, debug: true);
-
Method Names: Improved consistency
-
simple_callback_response()→simpleCallbackResponse() -
build_keyboard_of_inline()→buildKeyboardOfInline() -
get_text_message()→getTextMessage()
-
-
Parameter Handling: All methods now support named parameters
- File resource leak in debug mode
- Path traversal vulnerability in photo handling
- Missing input validation
- Improved error messages
- ❌ Identified critical vulnerabilities (documented in SECURITY.md)
- ✅ Token exposure via GET parameter (recommend environment variable)
- ✅ HTTPS enforcement
- ✅ Path validation for file access
- ✅ Webhook signature validation support
- Positional arguments (use named arguments instead)
- String-based callback data handling (still supported for compatibility)
- Legacy code cleanup
- Unused dependencies
- Complete API Reference
- Getting Started guide
- Security Best Practices guide
- Examples for common use cases
- Deployment guide
- Troubleshooting guide
- FAQ
- Initial stable release
- Core
botTGclass - Webhook-based update handling
- Command and callback query handling
- Keyboard builders (inline, links, merged)
- Message sending and editing
- Photo support
- Text templating
- Debug mode
- Telegram IP validation
Core methods:
-
commandSimple()- Handle text commands -
simpleCallbackResponse()- Handle button clicks -
sendMessage()- Send messages -
editMessage()- Edit existing messages -
buildKeyboardOfInline()- Create inline buttons -
buildKeyboardOfLinks()- Create link buttons -
mergeKeyboards()- Merge keyboards -
forward_message()- Forward messages - Callback query handling
- Private chat detection
-
botesempio.php- Feature-complete example -
echobot.php- Simple echo bot
- Not all Telegram Bot API methods implemented
- Long polling not supported
- Webhook-only architecture
- WIP status - actively developed
Breaking Changes:
- Constructor Signature - Use named arguments:
// Old
$bot = new botTG($token, $updates, true);
// New
$bot = new botTG(
token: $token,
updates: $updates,
debug: true
);- Method Names - Use camelCase:
// Old
$bot->command_simple("/start", "Hello");
$bot->simple_callback_response("data", "Response");
// New
$bot->commandSimple("/start", "Hello");
$bot->simpleCallbackResponse("data", "Response");- Readonly Properties - Properties are now readonly:
// This now throws an error
$bot->token = "new_token";Migration Steps:
- Update method names to camelCase
- Update constructor calls to use named arguments
- Update any direct property access
- Review security settings (enable HTTPS, use environment variables)
- Test thoroughly
Benefits of upgrading:
- Modern PHP 8.4 features
- Better type safety
- Improved security
- Better performance
- Comprehensive documentation
| Version | Status | Support Until | Notes |
|---|---|---|---|
| 2.x | Active | 2028-08-17 | Current |
| 1.x | Deprecated | 2026-08-17 | No new features |
- Major: Annually (breaking changes)
- Minor: Quarterly (new features)
- Patch: Monthly (bug fixes)
- Inline query support
- Payment handling
- Sticker management
- Additional Telegram methods
- Async request support
- Better type inference
- Performance optimizations
- Event system
- Full PSR-4 namespace
- MVC support
- Database ORM integration
- Plugin system
See CONTRIBUTING.md
For security issues, see SECURITY.md
TGbotPHP is licensed under the MIT License. See LICENSE