atymic/sms-broadcast 问题修复 & 功能扩展

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

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

atymic/sms-broadcast

Composer 安装命令:

composer require atymic/sms-broadcast

包简介

PHP client for the SMS Broadcast API

README 文档

README

Build Status StyleCI Latest Stable Version License

This is a simple API client for SMS Broadcast.

You can view their API documentation here.

Install

composer require atymic/sms-broadcast

Usage

Creating the client

$client = \Atymic\SmsBroadcast\Factory\ClientFactory::create(
    'username',
    'password',
    '0412345678' // Default sender, optional
);

Sending a message to a single recipient

try {
    $response = $client->send('0487654321', 'This is an sms message');
} catch (\Atymic\SmsBroadcast\Exception\SmsBroadcastException $e) {
    echo 'Failed to send with error: ' . $e->getMessage();
}

echo 'SMS sent, ref: ' . $response->getSmsRef();

Sending a message to a multiple recipients

$to = ['0487654321', '0487654322', '0487654323']
$responses = $client->sendMultiple($to, 'This is an sms message');

foreach ($responses as $response) {
    echo $response->hasError()
        ? 'Failed to send SMS: ' . $response->getError()
        : 'SMS sent, ref: ' . $response->getSmsRef();
}

Check SMS credit balance

echo $client->getBalance(); // int(1222)

Tests

By default only unit tests will run. If you want to run the integration tests, copy the phpunit.dist.xml file to phpunit.xml and supply your SMS Broadcast credentials & to number in the file.

WARNING - Integration tests will send real SMS messages, so make sure not to run them in CI.

composer test

Todo

  • Support for incoming message webhooks

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-06-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固