bossit / yii2-telegram-logger
Push the message in Telegram
Installs: 642
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: ^7.0
- longman/telegram-bot: ^0.53.0
- yiisoft/yii2: ~2.0.0
This package is auto-updated.
Last update: 2024-12-19 03:04:24 UTC
README
Push the message in Telegram channel.
Install
The preferred way to install this component is through composer.
$ composer require bossit/yii2-telegram-logger:^1.0
Usage
The preferred way is to setup the components into our Application's configuration array:
'components' => [ 'telegramLogger' => [ 'class' => \bossit\logger\TelegramService::class, 'botKey' => 'xxx:zzz', 'botName' => 'YouNameBot', 'channelId' => '-100xxx' ], ],
That's it, you are ready to use them as Yii2 components.
Send a message to channel:
\Yii::$app->telegramLogger->push('Hello, %username%!');
Send a message with title to channel:
\Yii::$app->telegramLogger->push('Hello, %username%!', 'Authorization');