aasanakey/smsonline 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

aasanakey/smsonline

最新稳定版本:v0.0.3

Composer 安装命令:

composer require aasanakey/smsonline

包简介

README 文档

README

Send Laravel Notifications via the smsonline GH SMS API

Installation

You can install the package via composer:

composer require aasanakey/smsonline

First you must install the service provider (skip for Laravel>=5.5):

// config/app.php
'providers' => [
    ...
    \Aasanakey\Smsonline\SmsonlineServiceProvider::class,
],

You can publish the config file with:

php artisan vendor:publish --tag=smsonline-config

or

php artisan vendor:publish --provider="Aasanakey\Smsonline\SmsonlineServiceProvider" --tag="smsonline-config"

Configuration

Add your smsonline Gh api access key, api host, sender Id/sender name.

Set your smsonline Gh api keys in your .env file.

SMSONLINE_HOST=Sms online api host

Or

Add api host to your config/smsonline.php:

// config/services.php
...
"host" => env('SMSONLINE_HOST','api.smsonlinegh.com'),
...

Set your smsonline Gh api keys in your .env file.

SMSONLINE_API_KEY=your smsonline api key

Or

Add your API Key to your config/smsonline.php:

// config/services.php
...
"api_key" => env('SMSONLINE_API_KEY',null),
...

For your smsonline API Key visit SMS API

Set your smsonline Gh sender Id in your .env file.

SMSONLINE_SENDER_ID=your sender ID

Or

Add your Send Id to your config/smsonline.php:

// config/services.php
...
"sender_id" => env('SMSONLINE_SENDER_ID',null),
...

For your smsonline API Key visit Sender Name

Usage

Now you can use the channel in your via() method inside the notification as well as send an sms notification using the smsonline api:

use Illuminate\Notifications\Notification;
use Aasanakey\Smsonline\SmsonlineSmsMessage;


class SMSNotification extends Notification
{
    public function via($notifiable)
    {
        return ['smsonlinegh'];
    }

    public function toSmsonline($notifiable)
    {
        return (new SmsonlineSmsMessage)
            ->sender('Sender ID')
            ->content('Your account was approved!')
            ->personalisedValues("List of data for personnalised message content"); // call this method if content has message variables placeholders
    }
}

Check balance

To check your sms balance use the checkBalance() method on SMSAPI object:

use Aasanakey\Smsonline\Sms;

$sms = new Sms();
$balance = $api->balance(); // returns balance info object
$amount = $balance->ammount // returns balance ammount
$currencyName = $balance->currencyName // returns the balance currency name
$currencyCode = $balance->currencyCode // return the balance ccurrency code

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固