This library handles all the SMSALES API's.
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
Follow the steps below on how to use the smsales-php-sdk:
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
]);
These are the responses.
{
"data": {
"message": "Accepted for dispatch..."
}
}
{
"sent": true,
"sender": "SHIFTECH",
"apiSender": "shiftech",
"phoneNumbers": [
"254XXXXXXXXX",
"254XXXXXXXXX",
"254XXXXXXXXX"
],
"batch": "1CRVD1GEXE",
"account": {
"smsBalance": "663",
"smsUsage": "24"
}
}
Version | Status | Packagist | Namespace | Repo |
---|---|---|---|---|
1.x | Latest | shiftechafrica/smsales-php-sdk |
SMSALES |
v1.2.0 |
For any security vulnerabilities, please email to Shiftech Africa.
This package is open-source, licensed under the MIT License.