1. Go to this page and download the library: Download unione/unione-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/ */
unione / unione-php example snippets
$client = new Unione\UnioneClient('YOUR-API-KEY', 'YOUR-HOST-NAME');
// Example for EU instance.
$client = new Unione\UnioneClient('YOUR-API-KEY', 'eu1.unione.io');
$recipients = [
[
"email" => '[email protected]',
"substitutions" => [
"to_name" => "John Smith"
],
],
[
"email" => '[email protected]',
"substitutions" => [
"to_name" => "Liza Frank"
],
]
];
$body = [
"html" => "<b>Test mail, {{to_name}}</b>",
"plaintext" => "Hello, {{to_name}}",
"amp" => "<!doctype html><html amp4email><head> <meta charset=\"utf-8\"><script async src=\"https://cdn.ampproject.org/v0.js\"></script> <style amp4email-boilerplate>body[visibility:hidden]</style></head><body> Hello, AMP4EMAIL world.</body></html>"
];
// You can use email object can be used to prepare the message array.
// But the email send method accepts an array, that can be composed without
// SDK utils.
$mail = new Unione\Model\Email($recipients, $body);
$mail->setFromEmail('[email protected]');
$mail->setSubject('test letter');
$response = $client->emails()->send($mail->toArray());
$client = new Unione\UnioneClient('YOUR-API-KEY', 'YOUR-HOST-NAME');
// $body contains a callback request body.
if ($client->webhooks()->verify($body) === TRUE) {
// The webhook is confirmed, result can be processed.
}
$client = new Unione\UnioneClient('YOUR-API-KEY', 'YOUR-HOST-NAME');
$response = $client->webhooks()->get('YOUR-WEBHOOK-URL');
$client = new Unione\UnioneClient('YOUR-API-KEY', 'YOUR-HOST-NAME');
$response = $client->webhooks()->list();
$client = new Unione\UnioneClient('YOUR-API-KEY', 'YOUR-HOST-NAME');
$response = $client->webhooks()->delete('YOUR-WEBHOOK-URL');