rapidsmsng/sms-php-sdk
Composer 安装命令:
composer require rapidsmsng/sms-php-sdk
包简介
Rapid SMS PHP SDK is built for Rapid SMS - Bulk SMS Application
README 文档
README
Rapid SMS PHP SDK is built for Rapid SMS - Bulk SMS Application
Prerequisites
To use Rapid SMS SDK you must have created an account with Rapid SMS. For more details please visit: Rapid SMS
php >=7.2
Rapid SMS - Bulk SMS Application
Installing
Via Composer
composer require rapidsmsng/sms-php-sdk
And Via Bash
git clone https://github.com/rapidsmsng/sms-php-sdk.git
Usage
Step 1:
If installing Rapid SMS SDK using Git Clone then load your Rapid SMS SDK Class files with the use of namespaces.
require_once 'src/RapidSMS.php'; use RapidSMS\RapidSMS;
If installing Rapid SMS API using Composer then require/include autoload.php file in the index.php of your project or whatever file you need to use Rapid SMS SDK classes:.
require 'vendor/autoload.php'; use RapidSMS\RapidSMS;
Step 2:
Get your API_KEY from https://rapidsmsng.com/sms-api/info (from within your account)
$apiKey = 'YWRtaW46YWRtaW4ucGFzc3dvcmQ=';
Step 3:
Change to your Sender ID. Submit Sender ID for approval from here https://rapidsmsng.com/user/sms/sender-id-management
$from = 'RapidSMSNG';
Step 4:
the number we are sending to - Any phone number
$destination = '08028333008';
For multiple number please use Comma (,) after every single number.
$destination = '08028333008,09054036811,09087040398';
You can insert maximum 100 numbers using comma separated string in single api request.
Step 5:
Replace your URL with https://rapidsmsng.com/sms/api.
sms/api is mandatory.
$url = 'https://rapidsmsng.com/sms/api';
// SMS Body
$sms = 'Test message from RAPID SMS';
// Unicode SMS
$unicode = '1'; //For Unicode message
// Schedule SMS
$scheduleDate = '05/17/2020 10:20 AM'; //Date like this format: m/d/Y h:i A
// Create Plain/text SMS Body for request
$smsBody = array( 'api_key' => $apiKey, 'to' => $destination, 'from' => $from, 'sms' => $sms );
// Create Unicode SMS Body for request
$smsBody = array( 'api_key' => $apiKey, 'to' => $destination, 'from' => $from, 'sms' => $sms, 'unicode' => $unicode, );
// Create SMS Body for Schedule request
$smsBody = array( 'api_key' => $apiKey, 'to' => $destination, 'from' => $from, 'sms' => $sms, 'schedule' => $scheduleDate, );
Step 6:
Instantiate a new Rapid SMS API request
$client = new RapidSMS\RapidSMS();
Send SMS
Finally send your sms through Rapid SMS API
$response = $client->sendSms($url, $smsBody);
Get Inbox
Get all your messages
$getInbox = $client->getInbox($apiKey, $url);
Get Balance
Get your account balance
$getBalance = $client->checkBalance($apiKey, $url);
Response
Rapid SMS API return response in json format, like:
{"code": "ok","message": "Successfully Send"}
Delivery Reports
Pushing delivery reports to an endpoint you specify is coming soon
Status Code
| Status | Message |
|---|---|
ok |
Successfully queued |
100 |
Bad gateway requested |
101 |
Wrong action |
102 |
Authentication failed |
103 |
Invalid phone number |
104 |
Phone coverage not active |
105 |
Insufficient balance |
106 |
Invalid sender id |
107 |
Invalid SMS type |
108 |
SMS gateway not active |
109 |
Invalid schedule time |
110 |
SMS contain spam word. Pending approval |
Authors
- Kenneth Onah - Initial work - rapidsmsng
rapidsmsng/sms-php-sdk 适用场景与选型建议
rapidsmsng/sms-php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 06 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 rapidsmsng/sms-php-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rapidsmsng/sms-php-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-06-16