Skip to content

Breaking backwards compatibility

Armando Lüscher edited this page Dec 26, 2020 · 3 revisions

This library is still under heavy development, so some changes will break backwards compatibility (BC). We try to keep breaking changes to a minimum, but also try to create the best solution for any given situation.

Here is a list of BC breaking changes in each version.

Remove BotManager::initLogging()

Before: Logging was defined in the parameter array passed to the BotManager constructor:

new BotManager([
    ...
    'logging' => [
        'debug'  => '/path/to/php-telegram-bot-debug.log',
        'error'  => '/path/to/php-telegram-bot-error.log',
        'update' => '/path/to/php-telegram-bot-update.log',
    ],
    ...
]);

Now: Logging must be initialised directly with any PSR-3 compliant logger.

Namespace and package name changed

Before:

  • Namespace: NPM\TelegramBotManager
  • Packagist: noplanman/telegram-bot-manager

Now:

  • Namespace: TelegramBot\TelegramBotManager
  • Packagist: php-telegram-bot/telegram-bot-manager

Parameter structure changed

The structure of the parameter array passed to the BotManager constructor has changed. Best compare the before and after versions to see what's different.

Before: Most parameters were only 1 level deep:

$params = [
    'webhook'         => 'https://example.com/manager.php',
    'certificate'     => __DIR__ . '/server.crt',
    'max_connections' => 20,
    'download_path'   => __DIR__ . '/Download',
    'upload_path'     => __DIR__ . '/Upload',    
];

Now: Parameters are grouped more logically.

$params = [
    'webhook' => [
        'url'             => 'https://example.com/manager.php',
        'certificate'     => __DIR__ . '/server.crt',
        'max_connections' => 20,
    ],
    'paths'   => [
        'download' => __DIR__ . '/Download',
        'upload'   => __DIR__ . '/Upload',
    ],
];