PHP code example of chibex / ozioma-laminas
1. Go to this page and download the library: Download chibex/ozioma-laminas library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
chibex / ozioma-laminas example snippets
return [
'ozioma' => [
'third-party' => [
'access-key' => 'YOUR ACCESS KEY HERE',
],
],
];
try {
$response = $this->oziomaClient()->getBalance();
var_dump($response);
} catch(\Chibex\Ozioma\Exception\ApiException $e){
print_r($e->getResponseObject());
die($e->getMessage());
}
try {
$response = $this->oziomaClient()->send(['sender' => 'php lib',
'message' => 'it is awesome',
'recipients' => '23470xxxxxxxx',
'use_corporate_route' => true, // [true or false]
'callback_url' => 'http://your-website/your-callback-url',
]);
var_dump($response);
} catch(\Chibex\Ozioma\Exception\ApiException $e){
print_r($e->getResponseObject());
die($e->getMessage());
}
try {
$response = $this->oziomaClient()->fetchSentMessage($id);
var_dump($response);
} catch(\Chibex\Ozioma\Exception\ApiException $e){
print_r($e->getResponseObject());
die($e->getMessage());
}
try {
$response = $this->oziomaClient()->fetchSentMessageExtras($id);
var_dump($response);
} catch(\Chibex\Ozioma\Exception\ApiException $e){
print_r($e->getResponseObject());
die($e->getMessage());
}
try {
$response = $this->oziomaClient()->schedule(['sender' => 'php lib',
'message' => 'it is awesome',
'recipients' => '23470xxxxxxxx',
'use_corporate_route' => true,
'callback_url' => 'http://your-website/your-callback-url',
'extras' => [[
'deliver_at' => '2019-07-23 10:10',
'time_zone_id' => 2,
]]]);
var_dump($response);
} catch(\Chibex\Ozioma\Exception\ApiException $e){
print_r($e->getResponseObject());
die($e->getMessage());
}
try {
$response = $this->oziomaClient()->addSubscriber([
'id' => 2, //sms newsletter id
'name' => 'Chibuike Mba',
'phone_no' => '23470xxxxxxxx']);
var_dump($response);
} catch(\Chibex\Ozioma\Exception\ApiException $e){
print_r($e->getResponseObject());
die($e->getMessage());
}
try {
$response = $this->oziomaClient()->addBulkSubscribers([
'id' => 2, //sms newsletter id
'subscribers' => [[
'name' => 'Izuchukwugeme Okafor',
'phone_no' => '23470xxxxxxxx'
],[
'name' => 'Franklin Nnakwe',
'phone_no' => '23480xxxxxxxx'
]]]);
var_dump($response);
} catch(\Chibex\Ozioma\Exception\ApiException $e){
print_r($e->getResponseObject());
die($e->getMessage());
}
try {
$response = $this->oziomaClient()->addBirthdayContactToGroup([
'group_id' => 7, //birthday group id
'name' => 'Dennis Okonnachi',
'phone_no' => '23470xxxxxxxx',
'day' => 9,
'month_id' => 1,
]);
var_dump($response);
} catch(\Chibex\Ozioma\Exception\ApiException $e){
print_r($e->getResponseObject());
die($e->getMessage());
}
try {
$response = $this->oziomaClient()->addBulkBirthdayContactsToGroup([
'group_id' => 7, //birthday group id
'contacts' => [[
'name' => 'Caleb',
'phone_no' => '23470xxxxxxxx',
'day' => 9,
'month_id' => 1,
]]]);
var_dump($response);
} catch(\Chibex\Ozioma\Exception\ApiException $e){
print_r($e->getResponseObject());
die($e->getMessage());
}