定制 kheme/php-supertext-nigeria 二次开发

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

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

kheme/php-supertext-nigeria

Composer 安装命令:

composer require kheme/php-supertext-nigeria

包简介

A simple PHP wrapper for SuperText Nigeria's SMS gateway API

README 文档

README

PHP Wrapper for SuperText Nigeria SMS Gateway

Latest Stable Version Latest Unstable Version Total Downloads License

Introduction

This is a simple PHP wrapper for SuperText Nigeria's SMS API gateway.

Installation

Using Composer:

composer require kheme/php-supertext-nigeria

Usage

Import the class before making your calls.

require_once 'vendor/autoload.php';
use Kheme\SuperTextNg\SMS;

Sending to a single recipient

$sms = new SMS('SUPERTEXTNG_USERNAME', 'SUPERTEXTNG_PASSWORD');
$sms->from('Kheme');
$sms->to('2348153332428')
$sms->message('Using the facade to send a message.')
$sms->send();   // returns true

If sending wasn't successful, an exception will be thrown.

Sending to multiple recipients

You can send an SMS to multiple recipients by including multiple to() in your call:

$sms = new SMS('SUPERTEXTNG_USERNAME', 'SUPERTEXTNG_PASSWORD');
$sms->from('Kheme');
$sms->to('2348153332428');
$sms->to('2348056511193');
$sms->message('Using the facade to send a message.');
$sms->send();   // returns true

Or, by supplying an array of phone numbers to a single to():

$sms = new SMS('SUPERTEXTNG_USERNAME', 'SUPERTEXTNG_PASSWORD');
$sms->from('Kheme');
$sms->to([
    '2348153332428',
    '2348056512393',
]);
$sms->message('Using the facade to send a message.');
$sms->send();   // returns true

Send to DND enabled numbers

To send SMS to numbers that have Do Not Disturb (DND) enabled, include ignoreDND() to your call:

$sms = new SMS('SUPERTEXTNG_USERNAME', 'SUPERTEXTNG_PASSWORD');
$sms->from('Kheme');
$sms->to('2348153332428');
$sms->message('Using the facade to send a message.');
$sms->ignoreDND();
$sms->send();   // returns true

Return unit balance after sending

If you would like to return your account balance after sending, include returnBalance() to your call:

$sms = new SMS('SUPERTEXTNG_USERNAME', 'SUPERTEXTNG_PASSWORD');
$sms->from('Kheme');
$sms->to('2348153332428');
$sms->message('Using the facade to send a message.');
$sms->returnBalance();
$sms->send();   // returns true

Return amount of units used for sending

If you would like to return the total amount of units used after sending, include returnUnitsUsed() to your call:

$sms = new SMS('SUPERTEXTNG_USERNAME', 'SUPERTEXTNG_PASSWORD');
$sms->from('Kheme');
$sms->to('2348153332428');
$sms->message('Using the facade to send a message.');
$sms->returnUnitsUsed();
$sms->send();   // returns true

Combining options

The above method options, exluding the balance() below, can be combined like in the following example:

$sms = new SMS('SUPERTEXTNG_USERNAME', 'SUPERTEXTNG_PASSWORD');
$sms->from('Kheme');;
$sms->to('2348153332428');
$sms->message('Using the facade to send a message.');
$sms->returnBalance();
$sms->returnUnitsUsed();
$sms->ignoreDND();
$sms->send();   // returns true

Checking account balance

To check your SuperText Nigeria credit balance, simply call balance():

$sms = new SMS('SUPERTEXTNG_USERNAME', 'SUPERTEXTNG_PASSWORD');
return $sms->balance();

Errors

In the case of an error, a call will return an error as follows:

The numbers on the left are the corresponding error code from SuperText Nigeria, but will not be included in the error response

  • 100: One or more required url parameter is missing or misspelt
  • 101: Username is blank
  • 102: Password is blank
  • 103: Destination is blank
  • 104: Message is blank
  • 105: Sender is blank
  • 200: Wrong username or password
  • 201: Account has not been activated
  • 202: Inactive account
  • 300: Insufficient credit
  • 400: Failed delivery (no credit deducted)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-09-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固