PHP code example of yonoma / yonoma-php

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

    

yonoma / yonoma-php example snippets




$yonoma = new Yonoma\ApiClient('YOUR-API-KEY');

$response = $yonoma->email->sendEmail([
    "from_email" => "[email protected]",
    "to_email" => "[email protected]",
    "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 protected]",
  "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",
]);

composer 

{
  ""yonoma/yonoma-php": "*"
  }
}