rosemalejohn/laravel-message-whiz

Laravel 对 Message Whiz API 的封装

v0.2.1-alpha 2022-04-01 06:51 UTC

This package is auto-updated.

Last update: 2024-09-29 06:02:25 UTC


README

安装

您可以通过 composer 安装此包

composer require rosemalejohn/laravel-message-whiz

包将自动注册自己。

您可以使用 Laravel Notification 发布配置文件

php artisan vendor:publish --provider="Rosemalejohn\MessageWhiz\MessageWhizServiceProvider"

通知

要在 Laravel 通知中使用 MessageWhiz,只需在通知的 via 方法上添加 \Rosemalejohn\MessageWhiz\NotificationChannel::class

public function via($notifiable)
{
    return ['database', 'broadcast', \Rosemalejohn\MessageWhiz\NotificationChannel::class]
}

然后实现该函数

public function toSms($notifiable): array
{
    return [
        'recipient' => $notifiable->phone_number,
        'message_body' => 'John Doe sent a like'
    ];
}

API 文档

对于完整的 API 文档,请访问 MessageWhiz API 文档

许可证

MIT 许可证 (MIT)。有关更多信息,请参阅 许可证文件