Microsoft Teams 通知包
Laravel 的 Teams 通知包允许你向 Microsoft Teams 发送通知。你可以发送普通消息、包含其他详细信息的消息,甚至可以使用此包的自定义日志记录频道:
use Osama\LaravelTeamsNotification\TeamsNotification;
// Normal message
new TeamsNotification()->sendMessage("System Notification");
// Message with additional details
new TeamsNotification()->sendMessage("System Notification", [
'Server' => 'Production',
'Status' => 'Running',
'Uptime' => '24 days'
]);
// Send a trace
try {
// ...
} catch (\Exception $exception) {
new TeamsNotification()
->bindTrace()
->error()
->sendException($exception);
}
日志记录功能将使用配置的日志频道向 Teams 频道发送消息:
Log::channel('teams')->info('This is an info message');
特性
- 发送常规消息:发送简单的文本通知给 Teams。
- 发送带有额外详情的消息:在通知中包含额外的详情。
- 发送成功消息:使用绿色高亮成功操作。
- 发送警告消息:使用橙色标注警告信息。
- 发送错误消息:使用红色报告错误以及栈跟踪可选。
- 使用 JSON 发送消息:引入格式化 JSON 数据。
- 自定义日志:使用 Laravel 的日志系统直接将日志消息直接发送给 Microsoft Teams。
- 消息颜色可配置: 使用预定义选项自定义消息颜色。
GitHub 源码:https://github.com/osa-eg/laravel-teams-notification