jambtc/yii2-telegram-notify

Yii2-oriented Telegram onboarding and notification toolkit

Maintainers

Package info

github.com/jambtc/yii2-telegram-notify

Type:yii2-extension

pkg:composer/jambtc/yii2-telegram-notify

Statistics

Installs: 342

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-03-05 17:09 UTC

This package is auto-updated.

Last update: 2026-03-05 17:14:38 UTC


README

Yii2-oriented Telegram onboarding and notification toolkit.

Install

composer require jambtc/yii2-telegram-notify:dev-main

Yii2 usage

Add component in config/web.php:

'components' => [
    'telegramNotify' => [
        'class' => Jambtc\Yii2TelegramNotify\YiiTelegramComponent::class,
        'botToken' => env('TELEGRAM_BOT_TOKEN', ''),
        'defaultChatId' => env('TELEGRAM_CHAT_ID', ''),
    ],
],

Send a message:

/** @var Jambtc\Yii2TelegramNotify\YiiTelegramComponent $tg */
$tg = Yii::$app->telegramNotify;
$result = $tg->sendText('Hello from Yii2');
// ['ok' => bool, 'error' => string|null]

Verify bot and build onboarding link:

$verify = $tg->verifyBot();
$link = $tg->buildDeepLink('@mybot', 1, 'binance');
$chat = $tg->findChatForTokenHash($link['token_hash']);

Exposed classes

  • TelegramClientInterface, TelegramClient
  • TelegramOnboardingInterface, TelegramOnboardingService
  • TelegramNotifierInterface, TelegramNotifier
  • YiiTelegramComponent

Test

composer install
vendor/bin/phpunit

License

MIT