zaxxas / laravel-simple-chat-notification
此包旨在向指定的聊天工具(Slack等)发送通知
v0.9.2
2023-02-27 10:38 UTC
Requires
- php: ^8.1.0
- guzzlehttp/guzzle: ^7.5
- illuminate/collections: ^9.0
Requires (Dev)
- barryvdh/laravel-ide-helper: ^2.13@dev
- friendsofphp/php-cs-fixer: ^3.0
- orchestra/testbench: ^7.22.1
- phpstan/phpstan: 1.10.x-dev
- phpunit/phpunit: ^9.5.1
This package is auto-updated.
Last update: 2024-09-27 14:12:00 UTC
README
此仓库是Laravel的库,用于向商业聊天工具发送通知。目前支持以下工具:
- Slack(仅支持webhook)
- Teams(仅支持webhook)
- Line(仅支持Line Notify)
目前,它只能同步发送通知。未来将添加异步支持。
用法
-
移动到目标Laravel项目的根目录。
-
运行以下命令
- 安装此库。
composer require zaxxas/laravel-simple-chat-notification
.
- 发布配置文件。
php artisan vendor:publish --tag=laravel-simple-chat-notification
- 安装此库。
-
更改以下源文件
- app/ServiceProviders/AppServiceProvider.php
'providers' => [ /* * Laravel Framework Service Providers... */ Illuminate\Auth\AuthServiceProvider::class, .... .... \Zaxxas\NotifyToChatTools\Providers\NotificationServiceProvider::class, // -> Add this line ], 'aliases' => Facade::defaultAliases()->merge([ .... 'InterventionImage' => Intervention\Image\Facades\Image::class, 'NotifyToChat' => Zaxxas\NotifyToChatTools\Facades\NotificationToChatToolFacade::class, // -> Add this line ])->toArray(),
-
将环境变量添加到.env文件
* : 必需
-
添加通知逻辑(例如,如下所示。)
\NotifyToChat::notify( new NotificationMessageContent( title: 'sample title', message: 'sample message', keyValueFields: ['key1' => 'value1', 'key2' => 'value2'], ) );