itpekov/telegram-message
最新稳定版本:1.0.2
Composer 安装命令:
composer require itpekov/telegram-message
包简介
Send message to Telegram channel via bot
关键字:
README 文档
README
Installation
You can install the package via composer:
composer require itpekov/telegram-message
Add in .env file variables:
TELEGRAM_CHAT_ID=your_chat_id TELEGRAM_BOT_TOKEN=your_bot_token
Usage
Scenario 1: send message from any place with:
Telegram::sendMessage('Your message');
Scenario 2: send exception messages with
Telegram::sendExceptionMessage($e);
Scenario 3: send all unhandled exceptions from your app
by adding/updating report method in Handler.php class
use Itpekov\TelegramMessage\Facades\Telegram; public function report(Throwable $e) { $e = $this->mapException($e); if ($this->shouldntReport($e)) { return; } Telegram::sendExceptionMessage($e); $this->reportThrowable($e); }
Customization
Optionally, You can publish the config file with:
php artisan vendor:publish --provider="Itpekov\TelegramMessage\TelegramMessageServiceProvider" --tag="config"
This is the contents of the published config file:
return [ 'chat_id' => env('TELEGRAM_CHAT_ID'), 'bot_token' => env('TELEGRAM_BOT_TOKEN'), ];
Optionally, you can publish the views using
php artisan vendor:publish --provider="Itpekov\TelegramMessage\TelegramMessageServiceProvider" --tag="views"
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-05-18