Skip to content

Configuration

Configure TeleBot for your PHP projects with these essential settings.

TIP

Default configuration works for most use cases. Customize only when needed.

Basic Setup

Single Bot Configuration

php
use WeStacks\TeleBot\TeleBot;

$bot = new TeleBot([
    'token' => 'YOUR_BOT_TOKEN', // Required
    'name' => 'MyBot'
]);

Multiple Bot Management

php
use WeStacks\TeleBot\BotManager;

$bot = new BotManager([
    'primary' => new TeleBot('YOUR_BOT1_TOKEN'),
    'secondary' => [ // Auto-instantiated
        'token' => 'YOUR_BOT2_TOKEN',
        'name' => 'MyBot2'
    ]
]);

$bot->getMe(); // Uses primary bot
$bot->bot('secondary')->getMe(); // Uses secondary bot

Core Parameters

Bot Configuration

ParameterTypeRequiredDefaultDescription
tokenstring✔️---Telegram bot token
namestringnullBot username for command parsing
api_urlstringTelegram API URLCustom API endpoint
httparray[]Custom Guzzle HTTP client options for API requests
kernelstring|arrayKernel::classKernel for update handling or array of handlers
storagestringFileStorage::classStorage driver for user states

Manager Configuration

ParameterTypeDefaultDescription
botsarray[]Array of bot configs
defaultstring|int|nullnullDefault bot name (first bot if unset)