razor-informatics / ri-notifier-php
Official PHP SDK for Razor Informatics Notifier Project
v0.1.3
2024-03-21 10:46 UTC
Requires
- php: >=7.1
- ext-json: *
- guzzlehttp/guzzle: ^6.0 || ^7.0
README
This SDK provides easier work with Razor Informatics Notifier API for applications written in PHP.
POSTMAN Collection
Documentation
To get the depth details of the api check 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 razor-informatics/ri-notifier-php
Usage
The SDK needs to be instantiated using your API key, which you can get from the project settings here.
Send Message Example
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);
Fetch message Example
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);
Get Account Details Example
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 Gateway Balance Example
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);