zafarjonovich / yii-telegram-notification
Yii telegram notification
Installs: 301
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:package
Requires
README
Assalomu aleykum. These components will help you send message notifications to telegram chats via telegram bots on your Yii application.
Installation
The preferred way to install this extension is through composer.
Either run
composer require zafarjonovich/yii-telegram-notification
or add
"zafarjonovich/yii-telegram-notification": "*"
to the require section of your composer.json
file.
Configuration
Add your app/config.php this component
<?php $config = [ ... 'components' => [ ... 'telegramNotification' => [ 'class' => \zafarjonovich\YiiTelegramNotification\YiiTelegramNotificationComponent::class, 'bot_token' => 'BOT_TOKEN_HERE' ], ]; ?>
Usage
<?php // Sending text message \Yii::$app->telegramNotification->send('chat_id',[ 'text' => "Hello world" ]); // Sending photo message, this example text will be comment of photo \Yii::$app->telegramNotification->send('chat_id',[ 'photo' => "PHOTO_URL", 'text' => "Hello world", ]); // Sending video message, this example text will be comment of video \Yii::$app->telegramNotification->send('chat_id',[ 'video' => "VIDEO_URL", 'text' => "Hello world", ]); // Send message multiple chats \Yii::$app->telegramNotification->multipleSend(['chat_id1','chat_id2'],[ 'text' => "Hello world" ]); ?>