承接 vmosoti/bongatech-sms 相关项目开发

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

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

vmosoti/bongatech-sms

Composer 安装命令:

composer require vmosoti/bongatech-sms

包简介

A PHP client library for BongaTech's API (http://bongatech.co.ke)

README 文档

README

Latest Stable Version Latest Unstable Version StyleCI Build Status Scrutinizer Code Quality SensioLabsInsight Total Downloads License

This is a PHP client library to be used with BongaTech's SMS API See Bonga Tech's Website for more

Installation

You can install the package via composer:

composer require vmosoti/bongatech-sms

Usage

Providing variables

The Config class requires to fetch some variable from the system environment. These variables are the ones used in initialization of the SMS class. In your .env file:

BONGATECH_USER_ID=
BONGATECH_PASSWORD=
BONGATECH_SENDER_ID=
BONGATECH_CALL_BACK_URL=

Initializing the SMS class

To initialize:

$sms = new  \VMosoti\BongaTech\SMS();

or simply use the magic helper function:

sms()  // you have the SMS object

Recipients and Messages

Each of them is an array of arrays. i.e

$recipients = array(
        array(
            'MSISDN' => '0722123456',
            'LinkID' => '',
            'SourceID' => 'your source id here'
        ),
        array(
            'MSISDN' => '0775345678',
            'LinkID' => '',
            'SourceID' => 'source id for this here'
        )
    );

and messages

$messages = array(
        array(
            'Text' => 'Message 1 goes here'
        ),
        array(
            'Text' => 'Message 2 goes here'
        )
    );

Sending to a single Recipient

$message = array(
        array(
            'Text' => 'This message is for a single recipient'
        )
    );
    
$recipient = array(
        array(
            'MSISDN' => '0722123456',
            'LinkID' => '',
            'SourceID' => 'your source id here'
        )
    );
    
$response = $sms->bulk()->toOne()->send($recipient, $message);

or use helper function

$response = sms()->bulk()->toOne()->send($recipient, $message);

The above returns a single Response object

Sending same sms to many recipients

$message = array(
        array(
            'Text' => 'This message goes to many recipients'
        )
    );
    
$recipients = array(
        array(
            'MSISDN' => '0722123456',
            'LinkID' => '',
            'SourceID' => 'source id for recipient 1'
        ),
        array(
            'MSISDN' => '0713678900',
            'LinkID' => '',
            'SourceID' => 'source id for recipient 2'
            ),
    );
    
$responses = $sms->bulk()->toMany()->send($recipients, $message);

Sending different sms to each recipient

$messages = array(
        array(
            'Text' => 'This is message for recipient 1'
        ),
        array(
             'Text' => 'This is message for recipient 2'
        )
    );
    
$recipients = array(
        array(
            'MSISDN' => '0722123456',
            'LinkID' => '',
            'SourceID' => 'source id for recipient 1'
        ),
        array(
            'MSISDN' => '0713678900',
            'LinkID' => '',
            'SourceID' => 'source id for recipient 2'
            ),
    );
    
$responses = $sms->bulk()->toMany()->send($recipients, $messages);

The above two examples returns an array of the Response object. Thus:

foreach($responses as $response){
$response->getCode();
------
}

Querying SMS units balance

$response = SMS::getBalance();

or just throw in the helper function

get_balance();

$response is Response object. thus

$response->getBalance()

Delivery Reports

In your callback,

$response = \VMosoti\BongaTech\DeliveryReport::get();

It returns Response object,

thus:

$response->getReport();
$response->getMessageID();
$response->getCorrelator();
$response->getSourceID();

See all possible reports here

Exceptions

catch \VMosoti\BongaTech\Exceptions\BongaTechException;

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Suggestions, pull requests , bug reporting and code improvements are all welcome. Feel free to get in touch.

Security

If you discover any security related issues, please email vincent@vmosoti.com.

Credits

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-02-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固