Skip to content

Changelog

maule edited this page Aug 16, 2026 · 1 revision

Changelog

All notable changes to TGbotPHP will be documented in this file.

[2.0.0] - 2026-08-17

✨ Major Changes

Complete rewrite with PHP 8.4+ features and security hardening

Added

  • 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

Changed

  • 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

Fixed

  • File resource leak in debug mode
  • Path traversal vulnerability in photo handling
  • Missing input validation
  • Improved error messages

Security

  • ❌ 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

Deprecated

  • Positional arguments (use named arguments instead)
  • String-based callback data handling (still supported for compatibility)

Removed

  • Legacy code cleanup
  • Unused dependencies

Documentation

  • Complete API Reference
  • Getting Started guide
  • Security Best Practices guide
  • Examples for common use cases
  • Deployment guide
  • Troubleshooting guide
  • FAQ

[1.0.0] - 2024

Added

  • Initial stable release
  • Core botTG class
  • 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

Features

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

Examples

  • botesempio.php - Feature-complete example
  • echobot.php - Simple echo bot

Known Limitations

  • Not all Telegram Bot API methods implemented
  • Long polling not supported
  • Webhook-only architecture
  • WIP status - actively developed

Upgrade Guides

From 1.x to 2.0

Breaking Changes:

  1. Constructor Signature - Use named arguments:
// Old
$bot = new botTG($token, $updates, true);

// New
$bot = new botTG(
    token: $token,
    updates: $updates,
    debug: true
);
  1. 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");
  1. Readonly Properties - Properties are now readonly:
// This now throws an error
$bot->token = "new_token";

Migration Steps:

  1. Update method names to camelCase
  2. Update constructor calls to use named arguments
  3. Update any direct property access
  4. Review security settings (enable HTTPS, use environment variables)
  5. Test thoroughly

Benefits of upgrading:

  • Modern PHP 8.4 features
  • Better type safety
  • Improved security
  • Better performance
  • Comprehensive documentation

Version Support

Version Status Support Until Notes
2.x Active 2028-08-17 Current
1.x Deprecated 2026-08-17 No new features

Release Schedule

  • Major: Annually (breaking changes)
  • Minor: Quarterly (new features)
  • Patch: Monthly (bug fixes)

Future Roadmap

2.1.0 (Planned)

  • Inline query support
  • Payment handling
  • Sticker management
  • Additional Telegram methods

2.2.0 (Planned)

  • Async request support
  • Better type inference
  • Performance optimizations
  • Event system

3.0.0 (Future)

  • Full PSR-4 namespace
  • MVC support
  • Database ORM integration
  • Plugin system

Contributing

See CONTRIBUTING.md

Security

For security issues, see SECURITY.md

License

TGbotPHP is licensed under the MIT License. See LICENSE


Back to Home

Clone this wiki locally