定制 laravel-notification-channels/smspoh 二次开发

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

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

laravel-notification-channels/smspoh

最新稳定版本:v2.0.0

Composer 安装命令:

composer require laravel-notification-channels/smspoh

包简介

Smspoh Notifications channel

README 文档

README

Latest Version on Packagist Total Downloads GitHub Tests Action Status Software License

This package makes it easy to send notifications using SmsPoh.

Contents

Installation

You can install this package via composer:

composer require laravel-notification-channels/smspoh

Setting up the Smspoh service

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

// config/services.php
...
'smspoh' => [
    'key' => env('SMSPOH_KEY', 'YOUR SMSPOH KEY HERE'),
    'secret' => env('SMSPOH_SECRET', 'YOUR SMSPOH SECRET HERE'),
    'from' => env('SMSPOH_FROM', 'YOUR SMSPOH SENDER HERE')
],
...

Usage

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

use Illuminate\Notifications\Notification;
use NotificationChannels\Smspoh\SmspohMessage;

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

    public function toSmspoh($notifiable)
    {
        return (new SmspohMessage)
            ->content("Your account was approved!")
            ->scheduledAt("2026-03-24 12:00:00")
            ->unicode()
            ->deliveryReceiptUrl("https://yourwebsite.com/webhook/smspoh-delivery-receipt");
    }
}

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

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

On-Demand Notifications

Sometimes you may need to send a notification to someone who is not stored as a "user" of your application. Using the Notification::route method, you may specify ad-hoc notification routing information before sending the notification:

Notification::route('smspoh', '5555555555')                      
            ->notify(new InvoicePaid($invoice));

Encrypted Messages

We strongly recommend using the encrypted message feature for corporates, banks, e-wallets, OTPs, and all other financial transactions. To encrypt your message, you can use the encrypt() and encryptKey() methods:

return (new SmspohMessage)
    ->content("Your Bank OTP Code is 12345")
    ->encrypt()
    ->encryptKey("YourEncryptKey");

Available Message methods

from(): Sets the sender's name. Make sure to register the sender name at you SmsPoh dashboard.

content(): Set a content of the notification message. This parameter should be no longer than 918 char(6 message parts),

test(): Send a test message to specific mobile number or not. This parameter should be boolean and default value is true.

scheduledAt(): Set the scheduled delivery time. The datetime string should be in Y-m-d H:i:s format.

encrypt(): Encrypt the message content. This parameter should be boolean and default value is true.

encryptKey(): Set the encryption key for the message content. If you do not specify the encryptKey, a random key will be generated by SMSPoh and included in the response body.

unicode(): Send as a unicode message. This parameter should be boolean and default value is true.

deliveryReceiptUrl(): Set a custom callback URL to receive delivery receipts for this message.

Upgrade

Please see UPGRADE for more information

Testing

$ composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

统计信息

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

GitHub 信息

  • Stars: 7
  • Watchers: 3
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-12-26