定制 aldemco/laravel-notification-channel-sms-ru 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aldemco/laravel-notification-channel-sms-ru

Composer 安装命令:

composer require aldemco/laravel-notification-channel-sms-ru

包简介

This package makes it easy to send notifications using [sms.ru](https://sms.ru) (aka SMSRU) with Laravel 7.0+ (fomvasss/laravel-notification-channel-sms-ru fork)

README 文档

README

Here's the latest documentation on Laravel's Notifications System:

https://laravel.com/docs/master/notifications

Contents

Installation

Install this package with Composer:

composer require aldemco/laravel-notification-channel-sms-ru:dev-main

The service provider gets loaded automatically. Or you can do this manually:

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

Setting up the SmsRu service

Add your SmsRu apiID, default sender name (or phone number) to your config/services.php:

// config/services.php
...
'sms_ru' => [
    'api_id'  => env('SMSRU_API_ID'),
],
...

Usage

You can use the channel in your via() method inside the notification:

use Illuminate\Notifications\Notification;
use NotificationChannels\SmsRu\SmsRuMessage;
use NotificationChannels\SmsRu\SmsRuChannel;

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

    public function toSmsru($notifiable)
    {
        return (new SmsRuMessage())->content("Hello SMS!!!")->test(true)->translit(false);
    }
}

In your notifiable model, make sure to include a routeNotificationForSmsru() method, which returns a phone number or an array of phone numbers.

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

Available methods

from(): Sets the sender's name or phone number.

content(): Set a content of the notification message.

time(): Example argument = time() + 7*60*60 - Postpone shipping for 7 hours.

translit(): Text transliteration

test(): Test SMS sending (free)

from(): Approved letter sender

parentId(): You can specify your partner ID if you integrate the code into a foreign system

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 22
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-04