PHP code example of chibex / ozioma-php
1. Go to this page and download the library: Download chibex/ozioma-php 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-php example snippets
$ozioma = new Chibex\Ozioma(ACCESS-KEY);
try
{
$response = $ozioma->message->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());
}
$ozioma = new Chibex\Ozioma(ACCESS-KEY);
try
{
$response = $ozioma->message->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());
}
$ozioma = new Chibex\Ozioma(ACCESS-KEY);
try
{
$response = $ozioma->newsletter->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());
}
$ozioma = new Chibex\Ozioma(ACCESS-KEY);
try
{
$response = $ozioma->newsletter->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());
}
$ozioma = new Chibex\Ozioma(ACCESS-KEY);
try
{
$response = $ozioma->birthday->addContactToGroup([
'group_id' => 7,
'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());
}
$ozioma = new Chibex\Ozioma(ACCESS-KEY);
try
{
$response = $ozioma->birthday->addBulkContactsToGroup([
'group_id' => 7,
'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());
}
$builder = new MetadataBuilder();
MetadataBuilder::$auto_snake_case = false;
bash
$ composer
php