The official PHP client library for the Yonoma Email Marketing API
Install via Packagist
composer require yonoma/yonoma-php
Or add the following to composer.json
{
"require": {
"yonoma/yonoma-php": "*"
}
}
require_once('/Yonoma/vendor/autoload.php');
$yonoma = new Yonoma\ApiClient('YOUR-API-KEY');$response = $yonoma->email->sendEmail([
"from_email" => "updates@yonoma.io",
"to_email" => "email@yourdomain.com",
"subject" => "Welcome to Yonoma - You're In!",
"mail_template" => "We're excited to welcome you to Yonoma! Your successful signup marks the beginning of what we hope will be an exceptional journey."
]);$response = $yonoma->lists->create([
"list_name" => "New list"
]);$response = $yonoma->lists->list();$response = $yonoma->lists->retrieve('list id');$response = $yonoma->lists->update('list id',[
"list_name" => "Updated list name"
]);$response = $yonoma->lists->delete('list id');$response = $yonoma->tags->create([
"tag_name" => "New tag"
]);$response = $yonoma->tags->list();$response = $yonoma->tags->retrieve('Tag id');$response = $yonoma->tags->update('Tag id',[
"tag_name" => "Updated tag name"
]);$response = $yonoma->tags->delete('Tag id');$response = $yonoma->contacts->create("list id", [
"email" => "email@example.com",
"status" => "Subscribed" | "Unsubscribed",
"firstName" => "Contact", //optional
"lastName" => "One", //optional
"phone" => "1234567890", //optional
"address" => "123, NY street", //optional
"city" => "NY City", //optional
"state" => "NY", //optional
"country" => "US", //optional
"zipcode" => "10001" //optional
]);$response = $yonoma->contacts->update("list id", "Contact id", [
"status" => "Subscribed" | "Unsubscribed",
]);$response = $yonoma->contacts->addTag("Contact id", [
"tag_id" => "Tag id",
]);$response = $yonoma->contacts->removeTag("Contact id", [
"tag_id" => "Tag id",
]);