shiftechafrica / smsales-php-sdk
Library for Smsales Api Triggers. Use this to send bulk sms.
Requires
- guzzlehttp/guzzle: ^7.5
README
Introduction
This library handles all the SMSALES API's.
Installing
The recommended way to install smsales-php-sdk is through Composer.
# Install package via composer
composer require shiftechafrica/smsales-php-sdk
Next, run the Composer command to install the latest stable version of shiftechafrica/smsales-php-sdk:
# Update package via composer
composer update shiftechafrica/smsales-php-sdk --lock
After installing, the package will be auto discovered, But if need you may run:
# run for auto discovery <-- If the package is not detected automatically -->
composer dump-autoload
Then run this, to get the config/smsales.php for your own configurations:
# run this to get the configuration file at config/smsales.php <-- read through it --> php artisan vendor:publish --provider="SMSALES\SMSALEServiceProvider"
A config/.php file will be created, follow the example below to define your own configurations.
# set your account secret key api token SMSALES_API_TOKEN=check_on_api_profile
Usage
Follow the steps below on how to use the smsales-php-sdk:
How to use the Library
How to use the smsales-php-sdk to initiate different levels of api's
use SMSALES\API\Trigger; /** * Fetch latest sent sms */ (new Trigger())->index(); /** * get sms account balance * @return mixed */ (new Trigger())->accountSmsBalance()); /** * get sms sender ids balance * @return mixed */ (new Trigger())->senderIDSmsBalance()); /** * initiate bulk sms * @return mixed */ (new Trigger())->send([ "api_sender" => "shiftech",// required check on your senderID's list for the API Sender "message" => "Hello Smsales.",// required "phone_numbers" => ["2547XXXXXXXX","2540XXXXXXXX","2547XXXXXXXX"],// required "scheduled_at" => "Y-m-d H:i:s", // optional "callback_url"=> "https://yourdomain/report"// optional this should be a POST request ]);
API Responses
These are the responses.
Successful bulk sms
{ "data": { "message": "Accepted for dispatch..." } }
Callback report for the bulk sms
{ "sent":true, "sender":"SHIFTECH", "apiSender":"shiftech", "phoneNumbers":[ "254XXXXXXXXX", "254XXXXXXXXX", "254XXXXXXXXX" ], "batch":"1CRVD1GEXE", "account":{ "smsBalance":"663", "smsUsage":"24" } }
Version Guidance
Security Vulnerabilities
For any security vulnerabilities, please email to Shiftech Africa.
License
This package is open-source, licensed under the MIT License.