PHP code example of ocuru / notifyme

1. Go to this page and download the library: Download ocuru/notifyme 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/ */

    

ocuru / notifyme example snippets


$Notify->ToName = "John Smith";
$Notify->ToEmail = "[email protected]";

$Notify->FromName = "No Reply - Ocuru";
$Notify->FromEmail = "[email protected]";

// ReplyTo isnt Required
$Notify->ReplyToName = "Support - Ocuru";
$Notify->ReplyToEmail = "[email protected]";

$Notify->Subject = "Example Notification";
$Notify->isHTML = true;
$Notify->MessagePlainText = "This is a example notification message.";
$Notify->MessageHTML = "<html><body><p>This is a example notification message.</p></body></html>";

$data = [
	"to" => [
    	"name" => to.name,
      	"email" => to.email
    ],
  	"from" => [
    	"name" => from.name,
      	"email" => from.email
    ],
  	"message" => [
      	"is_html" => true,
      	"html" => "<html><body><p>This is a example notification message.</p></body></html>",
    	"plain_text" => "This is a example notification message."
    ]
];

$Notify->ToPhoneNumber = "07704810577";

$Notify->FromSMSName = "Ocuru";
$Notify->FromPhoneNumber = "447733806389"; // Valid Twilio Number with Country Prefix

// Below Message will send with the following format.
// From Ocuru: This is a example notification message.
$Notify->MessageSMS = "This is a example notification message."; 

$data = [
	"to" => [
      	"name" => to.name,
    	"number" => to.number
    ],
  	"from" => [
       	"name" => from.name,
    	"number" => from.number
    ],
  	"message" => [
    	"short" => message.short
    ]
];

use Ocuru\Notify\Notify;

$Notify = new Notify;

$_ENV['ENV_LOCATION'] = __DIR__; // Directory of which your .env file is located

$dotenv = new Dotenv\Dotenv($_ENV['ENV_LOCATION']);
$dotenv->load();

$Notify->use($arrayOfServices);
$Notify->start();

$Notify->notify();

$Notify->notify($arrayOfServices);