xn/ext-notification
最新稳定版本:v1.0.6
Composer 安装命令:
composer require xn/ext-notification
包简介
laravel-admin notification helper
README 文档
README
Install & ENV
# composer
composer require xn/ext-notification
#publish config
php artisan vendor:publish --tag="ext-notification-config"
php artisan migrate
EXT_NOTIFY_PHRASE=
EXT_NOTIFY_SEED=
admin page
{APP_URL}/admin/notify-bots
{APP_URL}/admin/notify-chats
Notify Class
# line
\Xn\ExtNotification\Services\Notify::LineBot($chatToken)->send($message);
#$bot = new \Xn\ExtNotification\Services\LineBot($chatToken);
#$bot->send("測試看看\n測試Class");
# telegram
\Xn\ExtNotification\Services\Notify::TelegramBot($chatToken)->send($message);
#$bot = new \Xn\ExtNotification\Services\TelegramBot($chatToken);
#$res = $bot->send("測試看看\n測試Class");
# discord
\Xn\ExtNotification\Services\Notify::DiscordBot($chatToken)->send($message);
#$bot = new \Xn\ExtNotification\Services\DiscordBot($chatToken);
#$res = $bot->send("測試看看\n測試Class");
發送訊息
{APP_URL}/notify/line/send
{APP_URL}/notify/telegram/send
# 參數
{
"token": "", // Chat token
"message": "測試\n換行"
}
Notify Helper (Using AccessToken)
$notifier = new Xn\ExtNotification\Helpers\Notifier\Notifier();
$notifier
->telegram($botToken, $chatId)
->line($accessToken, $chatId)
->discord($botToken, $channelId)
->send("測試\n可以了");
CSRF
# bootstrap/app.php
->withMiddleware(function (Middleware $middleware) {
$middleware->validateCsrfTokens(except: [
'notify/*',
]);
})
webhook
{APP_URL}/notify/{type}/{botId}/webhook
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-10-16