saralsms / sdk-for-php
SaralSMS SDK for the PHP programming language.
Installs: 1 388
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^7.2.5
- ext-curl: *
- ext-json: *
- ext-openssl: *
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- fzaninotto/faker: ^1.9
- phpunit/phpunit: ^8.5
- vlucas/phpdotenv: ^5.1
README
SaralSMS SDK for PHP
The SaralSMS SDK for PHP makes it easy for developers to access SaralSMS API service in their PHP code, and build robust SMS based applications and software.
Getting Started
- Sign up for SaralSMS – Before you begin, you need to sign up for an SaralSMS account and retrieve your Credentials.
- Minimum requirements – To run the SDK, your system will need to meet the minimum requirements, including having PHP >= 7.2. We highly recommend having it compiled with the cURL extension and cURL compiled with a TLS backend (e.g., NSS or OpenSSL).
Installation
Install the SDK – Using Composer is the recommended way to install the SaralSMS SDK for PHP. The SDK is available via Packagist under the saralsms/sdk-for-php
package.
composer require saralsms/sdk-for-php
Getting Help
We use the GitHub issues for tracking bugs and feature requests and address them as quickly as possible.
- Call/Email SaralSMS Support or open ticket in your dashboard.
- If it turns out that you may have found a bug, please open an issue.
Quick Examples
Create a SaralSMS client
// require the composer autoloader. require 'vendor/autoload.php'; use SaralSMS\Client; // instantiate a SaralSMS client. $client = new Client('f9c6......55c1');
Send Message
This will send the message to one or multiple numbers in an array.
$client->send(['9851xxx123', '9801xxx456'], 'This is test message from API.');
Sample Response
{ "message": "2 messages queued for delivery." }
Credits
This will return the available credits and total messages sent.
$client->getCredits();
Sample Response
{ "credits": 6584, "total_sent": 3416 }
Reports
This will return historical messages reports including networks, charges and status.
$pageNumber = 1; $client->getReports($pageNumber);
Sample Response
{ "pages": 126, "data": [ { "id": 56480058, "receiver": "9779851xxx123", "network": "ntc", "message": "Fruits are an excellent source of essential vitamins and minerals.", "api_credit": "1", "delivery_at": "2020-07-09 01:45:09" }, { "id": 56480057, "receiver": "9779801xxx456", "network": "ncell", "message": "Vegetables are important sources of many nutrients, including potassium, dietary fiber.", "api_credit": "1", "delivery_at": "2020-07-08 07:25:31" } ] }