fomvasss/laravel-notification-channel-sendberry

此包使您能够通过 [sendberry.com](https://sendberry.com) 在 Laravel 9.0+ 中轻松发送通知。

1.0.1 2023-10-27 12:08 UTC

This package is auto-updated.

Last update: 2024-09-25 15:54:21 UTC


README

以下是 Laravel 通知系统最新文档

https://laravel.net.cn/docs/master/notifications

Latest Version on Packagist Software License Quality Score Code Coverage Total Downloads

此包使您能够通过 sendberry.com 在 Laravel 9.0+ 中轻松发送通知。

内容

安装

使用 Composer 安装此包

composer require fomvasss/laravel-notification-channel-sendberry

服务提供程序会自动加载。或者您也可以手动操作

// config/app.php
'providers' => [
    ...
    NotificationChannels\Sendberry\SendberryServiceProvider::class,
],

设置

在您的 config/services.php 中添加您的 Sendberry 令牌、默认发送者名称(或电话号码)、测试模式

// config/services.php
...
'sendberry' => [
    'username'  => env('SENDBERRY_USERNAME'),
    'password'  => env('SENDBERRY_PASSWORD'),
    'auth_key'  => env('SENDBERRY_AUTH_KEY'),
    'from'  => env('SENDBERRY_FROM'),
    'webhook'  => env('SENDBERRY_WEBHOOK'),
    'test_mode'  => env('SENDBERRY_TEST_MODE', false),
],
...

使用

您可以在通知内的 via() 方法中使用该通道

use Illuminate\Notifications\Notification;
use NotificationChannels\Sendberry\SendberryMessage;
use NotificationChannels\Sendberry\SendberryChannel;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return [SendberryChannel::class];
    }

    public function toSendberry($notifiable)
    {
        return (new SendberryMessage())->content("Hello SMS!!!")->test(true);
    }
}

在您的可通知模型中,请确保包含一个 routeNotificationForSendberry() 方法,该方法返回一个电话号码或电话号码数组。

public function routeNotificationForSendberry()
{
    return $this->phone;
}

可用方法

from():设置发送者的名称或电话号码,测试时使用 "Info SMS"。

content():设置通知消息的内容。

date():示例参数 = 12.05.2020

time():示例参数 = 13:00

test():测试短信发送

变更日志

有关最近更改的更多信息,请参阅 CHANGELOG

安全

如果您发现任何安全相关的问题,请通过电子邮件 fomvasss@gmail.com 而不是使用问题跟踪器。

贡献

有关详细信息,请参阅 CONTRIBUTING

致谢

许可证

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