jambtc / yii2-telegram-notify
Yii2-oriented Telegram onboarding and notification toolkit
Package info
github.com/jambtc/yii2-telegram-notify
Type:yii2-extension
pkg:composer/jambtc/yii2-telegram-notify
v0.1.0
2026-03-05 17:09 UTC
Requires
- php: >=7.4.0
- yiisoft/yii2: ~2.0.45
Requires (Dev)
- phpunit/phpunit: ^9.6
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,TelegramClientTelegramOnboardingInterface,TelegramOnboardingServiceTelegramNotifierInterface,TelegramNotifierYiiTelegramComponent
Test
composer install vendor/bin/phpunit
License
MIT