philipnjuguna / advanta
Advanta sms sdk for laravel
1.0.0.3
2022-02-16 11:27 UTC
Requires
- guzzlehttp/guzzle: ^7.2
- nesbot/carbon: ^2.43
Requires (Dev)
- phpunit/phpunit: ^9.5
- symfony/dotenv: ^4.3@dev
This package is auto-updated.
Last update: 2024-12-17 08:32:40 UTC
README
This SDK provides convenient access to the Advanta Africa sms API for applications written in PHP.
Documentation
Take a look at the API docs here.
Install
You can install the PHP SDK via composer or by downloading the source
Via Composer
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=
Usage
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);
Delivery Report
To read message delivery report;
(new AdvantaSMS())->getDelivery($messageId);
Result
{ "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" }
Balance Report
To request account balance;
(new AdvantaSMS())->getBalance();
Result
{ "response-code": 200, "credit": "800.00", "partner-id": "XXXX" }
Issues
If you find a bug, please file an issue on our issue tracker on GitHub.