This SDK provides easier work with Razor Informatics Notifier API for applications written in PHP.
To get the depth details of the api check 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 razor-informatics/ri-notifier-phpThe SDK needs to be instantiated using your API key, which you can get from the project settings here.
use RazorInformatics\RiNotifierPhp;
$apiKey = 'YOUR_API_KEY';
$razor = new RiNotifierPhp\Notifier($apiKey);
$results = $razor->message()->send([
'phone_number' => 0700XXXYYY,
'message' => "Howdy welcome to the team"
]);
print_r($results);details of a previous sent message.
use RazorInformatics\RiNotifierPhp;
$apiKey = 'YOUR_API_KEY';
$razor = new RiNotifierPhp\Notifier($apiKey);
$results = $razor->message()->fetchMessage('MESSAGE ID');
print_r($results);Decode a hash to retrieve the original message details.
use RazorInformatics\RiNotifierPhp;
$apiKey = 'YOUR_API_KEY';
$razor = new RiNotifierPhp\Notifier($apiKey);
$results = $razor->decoder()->decode('HASH_VALUE');
print_r($results);On success, this will return:
[
'status' => 'success',
'data' => [
'phone_number' => '254700100100',
'charged' => 0.1
]
]On failure, it will return:
[
'status' => 'error',
'message' => 'Error message here',
'data' => []
]The data available is project details & current account balance
use RazorInformatics\RiNotifierPhp;
$apiKey = 'YOUR_API_KEY';
$razor = new RiNotifierPhp\Notifier($apiKey);
$results = $razor->account()->getDetails();
print_r($results);Get the account balance of gateway selected when available. Available gateways are
- Notifier (project balance)
- Celcom Africa
- Emreign
- Africa’s Talking
- Onfon Media
- Web SMS
- more coming soon.
use RazorInformatics\RiNotifierPhp;
$apiKey = 'YOUR_API_KEY';
$razor = new RiNotifierPhp\Notifier($apiKey);
$results = $razor->gateway(Constants::GATEWAY_NOTIFIER)->details();
print_r($results);