yonoma / yonoma-php
The official PHP client library for the Yonoma Email Marketing API
1.0.0
2025-03-21 06:50 UTC
Requires
- php: ^7.4 || ^8.0
- guzzlehttp/guzzle: ^7.0
README
The official PHP client library for the Yonoma Email Marketing API
Installation
Install via Packagist
composer require yonoma/yonoma-php
Or add the following to composer.json
{
"require": {
"yonoma/yonoma-php": "*"
}
}
Quick Start
Note : This SDK requires PHP version 7.4 or above.
require_once('/Yonoma/vendor/autoload.php'); $yonoma = new Yonoma\ApiClient('YOUR-API-KEY');
Send an Email
$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." ]);
Lists
Create new list
$response = $yonoma->lists->create([ "list_name" => "New list" ]);
Get list of lists
$response = $yonoma->lists->list();
Get one list
$response = $yonoma->lists->retrieve('list id');
Update list
$response = $yonoma->lists->update('list id',[ "list_name" => "Updated list name" ]);
Delete list
$response = $yonoma->lists->delete('list id');
Tags
Create new tag
$response = $yonoma->tags->create([ "tag_name" => "New tag" ]);
Get list of tags
$response = $yonoma->tags->list();
Get one tag
$response = $yonoma->tags->retrieve('Tag id');
Update tag
$response = $yonoma->tags->update('Tag id',[ "tag_name" => "Updated tag name" ]);
Delete tag
$response = $yonoma->tags->delete('Tag id');
Contacts
Create new contact
$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 ]);
Update contact
$response = $yonoma->contacts->update("list id", "Contact id", [ "status" => "Subscribed" | "Unsubscribed", ]);
Add tag to contact
$response = $yonoma->contacts->addTag("Contact id", [ "tag_id" => "Tag id", ]);
Remove tag from contact
$response = $yonoma->contacts->removeTag("Contact id", [ "tag_id" => "Tag id", ]);