joecampo / laravel-notification-basecamp
将通知发布到Basecamp 3的营火
5.0.0
2024-08-20 21:56 UTC
Requires
- php: >=7.2
- guzzlehttp/guzzle: ^7.0
- illuminate/notifications: 5.8.*|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
- illuminate/support: 5.8.*|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
Requires (Dev)
- mockery/mockery: ^1.0
- orchestra/testbench: ^7.0
- phpunit/phpunit: ^9.5
README
Basecamp 3聊天机器人营火通知通道,适用于Laravel。
安装
您可以通过composer安装此包
composer require joecampo/laravel-notification-basecamp
使用方法
在Laravel通知中,您现在可以使用它作为via()
的通道
use Illuminate\Notifications\Notification; use NotificationChannels\Basecamp\CampfireChannel; use NotificationChannels\Basecamp\CampfireMessage; class ReviewCreated extends Notification { public function via($notifiable) { return [CampfireChannel::class]; } public function toCampfire($notifiable) { return CampfireMessage::create()->data('Hello from my chatbot 🤖'); } }
您需要在您的可通知模型中实现一个routeNotificationForBasecamp
方法,该方法返回Basecamp 3为您的聊天机器人提供的webhook URL。(设置Basecamp 3聊天机器人)
public function routeNotificationForBasecamp() { return 'https://basecamp3.lvh.me'; }
消息
Basecamp允许聊天机器人发布以下标签:table
tr
td
th
thead
tbody
details
summary
。您可以在富文本内容中使用以下标准HTML标签:div
、h1
、br
、strong
、em
、strike
、a
(带有href属性)、pre
、ol
、ul
、li
和 blockquote
。
此包提供用于简单消息和详细信息/摘要消息的辅助函数。
简单消息
CampfireMessage::create()->data("It Doesn't Have To Be Crazy At Work");
摘要加详细信息
摘要将显示,除非点击,否则详细信息将被隐藏。这对于显示可能具有长堆栈跟踪等的信息非常有用。
CampfireMessage::create() ->summary('This is the text/markup used as the summary') ->details('This is the text/markup that is hidden unless clicked on in the UI');
测试
composer test
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。