weldon/laravel-telegram-notifier
最新稳定版本:v1.0.0
Composer 安装命令:
composer require weldon/laravel-telegram-notifier
包简介
This package send errors and messages to your telegram group or chat.
README 文档
README
This package send bugs and messages to your telegram group or chat.
Screenshots
Installation
Install this project with composer
composer require weldon/laravel-telegram-notifier
To control it, create config file
php artisan vendor:publish --provider="Weldon\LaravelTelegramNotifier\LaravelTelegramNotifierServiceProvider"
Add your bot token and receiver chat id to .env file.
TELEGRAM_NOTIFIER_BOT_TOKEN=
CHAT_ID=
TELEGRAM_NOTIFIER_RESPONSIBLE=@someone
I recommend that you only use it on production.
To do this, change the value of TELEGRAM_NOTIFIER_ENABLED in .env to production.
TELEGRAM_NOTIFIER_ENABLED=false
Custom usage
If you want to send custom message, there is notify function:
<?php use Weldon\LaravelTelegramNotifier\Facades\TelegramNotifier; TelegramNotifier::notify("There is your text")
Also, there is error function to send handled error:
<?php use Weldon\LaravelTelegramNotifier\Facades\TelegramNotifier; try { ... } catch (Exception $exception) { TelegramNotifier::error($exception); }
Configuration
There are laravel-telegram-notifier.php in your config folder.
If you want to send bag to two or three chat ids you add chat id to chat_ids array of laravel-telegram-notifier.php file.
"chat_ids" => [env("CHAT_ONE_ID"), env("CHAT_TWO_ID"), env("CHAT_THREE_ID")],
Running Tests
To verify that the package is fully installed and working. You can run the command below which will help you create a new dummy error.
php artisan notify:check
In production mode you can load configurations from .env with php artisan config:clear command.
统计信息
- 总下载量: 388
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-02-21