This SDK provides convenient access to the Advanta Africa sms API for applications written in PHP.
Take a look at the API docs here.
You can install the PHP SDK via composer or by downloading the source
The recommended way to install the SDK is with Composer.
composer require philipnjuguna/advanta
Configuration At your project root, create a .env file and in it set the PARTNER ID , API KEY and SHORT CODE as follows
ADVANTA_PARTNER_ID=
ADVANTA_API_KEY=
ADVANTA_SHORT_CODE=
The SDK needs to be instantiated using API key, which you can get from the dashboard.
use PhilipNjuguna\Advanta\AdvantaSMS;
$advanta = (new AdvantaSMS())->sendMessage($mobile, $message);
// Use the service
$result = (new AdvantaSMS())->sendMessage('2XXYYYOOO',"message");
// Use the service for laravel
$result = \PhilipNjuguna\Advanta\AdvantaFacade::sendMessage("254700123456","message");
// For scheduled message add time as the third variable
$result = \PhilipNjuguna\Advanta\AdvantaFacade::sendMessage("254700123456","message", \Carbon\Carbon::now()->addRealMinutes(10));
print_r($result);
To read message delivery report;
(new AdvantaSMS())->getDelivery($messageId);
{
"response-code": 200,
"message-id": "89999",
"response-description": "Success",
"delivery-status": 32,
"delivery-description": "DeliveredToTerminal",
"delivery-tat": "6s",
"delivery-networkid": 1,
"delivery-time": "2020-02-16 10:15:13"
}
To request account balance;
(new AdvantaSMS())->getBalance();
{
"response-code": 200,
"credit": "800.00",
"partner-id": "XXXX"
}
If you find a bug, please file an issue on our issue tracker on GitHub.