承接 sykez/genusis-sms 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

sykez/genusis-sms

Composer 安装命令:

composer require sykez/genusis-sms

包简介

Genusis Gensuite v10 API SMS Channel for Laravel.

README 文档

README

Latest Version on Packagist Software License Total Downloads

This package makes it easy to send notifications using Genusis SMS Gateway via Gensuite API with Laravel.

Contents

Installation

Install package via Composer:

composer require sykez/genusis-sms

Setting up the Genusis SMS service

Add the service configration into your config/services.php:

'genusis-sms' => [
	'client_id' => env('GENUSIS_SMS_CLIENT_ID', null),
	'username' => env('GENUSIS_SMS_USERNAME', null),
	'private_key' => env('GENUSIS_SMS_PRIVATE_KEY', null),
	'url' => env('GENUSIS_SMS_URL', null),
	'debug_log' => env('GENUSIS_SMS_DEBUG_LOG', false),
],

Add the environment variablesinto your .env and set your Client ID, Username, Private Key and API URL.

GENUSIS_SMS_CLIENT_ID=
GENUSIS_SMS_USERNAME=
GENUSIS_SMS_PRIVATE_KEY=
GENUSIS_SMS_URL=

Usage

Now you can send SMS from your notification:

Sending Notification

use Sykez\GenusisSms\GenusisSmsChannel;
use Sykez\GenusisSms\GenusisSmsMessage;
use Illuminate\Notifications\Notification;

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

    public function toSms($notifiable)
    {
        return (new GenusisSmsMessage)->content("Hello there!");
    }
}

Routing Notification

You can route the notification to a phone number with to():

public function toSms($notifiable)
{
	return (new GenusisSmsMessage)->content("Hello there!")->to(01234567891);
}

Or you can add routeNotificationForSms() method in your notifiable model:

public function routeNotificationForSms()
{
    return $this->phone_number;
}

You can also do on-demand notifications:

use Illuminate\Support\Facades\Notification;
Notification::route('sms', '01234567891')->notify(new App\Notifications\SendSms(['Hello again.']));

Logs & Debug

You can set your GENUSIS_SMS_DEBUG_LOG=true in your .env to send all requests and responses to into your Laravel logs.

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-02-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固