定制 shiroamada/gosms 二次开发

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

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

shiroamada/gosms

Composer 安装命令:

composer require shiroamada/gosms

包简介

GoSMS Notifications channel for Laravel 5.3 - 11

README 文档

README

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

This package makes it easy to send notifications using https://gosms.com.my with Laravel 5.3 through 11.

Code Reference from laravel-notification-channels/smsc-ru

Contents

Installation

You can install the package via composer:

composer require shiroamada/gosms

Then you must install the service provider:

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

Setting up the GoSMS service

Add your gosms.com.my login, secret key (hashed password) and default sender name (or phone number) to your config/services.php:

// config/services.php
...
'gosms' => [
    'company'   => env('GOSMS_COMPANY'),
    'username'  => env('GOSMS_USERNAME'),
    'password'  => env('GOSMS_PASSWORD'),
    'sender'    => env('GOSMS_SENDER'),
    'gateway'   => env('GOSMS_GATEWAY', 'L'),
    'mode'      => env('GOSMS_MODE', 'BUK'),
    'type'      => env('GOSMS_TYPE', 'TX'),
    'charge'    => env('GOSMS_CHARGE', '0'),
    'maskid'    => env('GOSMS_MASKID', '1'),
    'convert'   => env('GOSMS_CONVERT', '0')
],
...

Usage

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

use Illuminate\Notifications\Notification;
use NotificationChannels\GoSms\GoSmsMessage;
use NotificationChannels\GoSms\GoSmsChannel;

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

    public function toGoSms($notifiable)
    {
        return GoSmsMessage::create("Task #{$notifiable->id} is complete!");
    }
}

In your notifiable model, make sure to include a routeNotificationForGoSms() method, which returns the phone number. Newer Laravel versions pass the Notification instance as an optional argument, so this signature is broadly compatible:

public function routeNotificationForGoSms($notification = null)
{
    return $this->mobile; //depend what is your db field
}

Available methods

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

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

sendAt(): Set a time for scheduling the notification message.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please use the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-10-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固