rapidsmsng / sms-php-sdk
Rapid SMS PHP SDK is built for Rapid SMS - Bulk SMS Application
Requires
- php: >=7.2
- ext-curl: *
- ext-json: *
This package is auto-updated.
Last update: 2025-04-25 13:15:45 UTC
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