dgvai/laravel-notification-channel-onnorokomsms

Laravel 通知通道包 For OnnorokomSMS BD

1.0.3 2020-06-26 16:25 UTC

This package is auto-updated.

Last update: 2024-09-27 01:56:19 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License Monthly Downloads Daily Downloads composer.lock

此包使得通过 Laravel 5.5+、6.x 和 7.x 向 OnnorokomSMS 批量短信服务(孟加拉国)发送短信变得简单。

内容

安装

您可以通过 composer 安装此包

composer require dgvai/laravel-notification-channel-onnorokomsms

设置配置

将你的 OnnorokomSMS 账户凭证添加到 config/services.php

// config/services.php
...
'onnorokomsms' => [
    'username'      =>  env('ONNOROKOMSMS_USERNAME'),       // The username of OnnorokomSMS service
    'password'      =>  env('ONNOROKOMSMS_PASSWORD'),       // The password of OnnorokomSMS service
    'type'          =>  env('ONNOROKOMSMS_TYPE'),           // TEXT or UCS 
    'mask_name'     =>  env('ONNOROKOMSMS_MASK_NAME'),      // optional but not null use ''
    'campaign_name' =>  env('ONNOROKOMSMS_CAMPAIGN_NAME'),  // optional but not null use ''
],
...

为了让你的通知知道你发送给哪个手机,该通道将查找可通知模型(例如用户模型)的 mobile_number 属性。如果你想覆盖这种行为,将 routeNotificationForOnnorokomSMS 方法添加到你的可通知模型中。

public function routeNotificationForOnnorokomSMS()
{
    return '+1234567890';
}

用法

现在你可以在通知中的 via() 方法中使用此通道

use DGvai\OnnorokomSMS\OnnorokomSMS;
use DGvai\OnnorokomSMS\OnnorokomSMSChannel;
use Illuminate\Notifications\Notification;

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

    public function toOnnorokomSMS($notifiable)
    {
        return new OnnorokomSMS('Your order has been placed!');
    }
}

变更日志

请参阅 变更日志 了解最近有哪些变化。

许可

MIT 许可证 (MIT)。请参阅 许可文件 了解更多信息。