Skip to content

SHIFTECH-AFRICA/smsales-php-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Always Delivering


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

Version Status Packagist Namespace Repo
1.x Latest shiftechafrica/smsales-php-sdk SMSALES v1.2.0

Security Vulnerabilities

For any security vulnerabilities, please email to Shiftech Africa.

License

This package is open-source, licensed under the MIT License.

About

SMSALES API library, get started quickly.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages