drupalcoders/dotmailer-php

PHP Client library for the Dotmailer REST (v2) API

v1.2.3 2020-06-19 09:51 UTC

This package is auto-updated.

Last update: 2024-04-19 18:53:05 UTC


README

PHP client library for the Dotmailer REST API (v2) described at https://developer.dotmailer.com/docs/

Installation

composer require wellcometrust/dotmailer-php

Usage

<?php

use Dotmailer\Adapter\GuzzleAdapter;
use Dotmailer\Dotmailer;

require 'vendor/autoload.php';

$adapter = GuzzleAdapter::fromCredentials('apiuser-XYZ@apiconnector.com', 'PASSWORD');
$dotmailer = new Dotmailer($adapter);

$addressBooks = $dotmailer->getAddressBooks();
print_r($addressBooks);

If you are using Symfony, you may choose to configure the service as follows, and then use throughout your application:

# app/config/services.yml

Dotmailer\Adapter:
   factory: ['Dotmailer\Adapter\GuzzleAdapter', fromCredentials]
   arguments: ['%dotmailer_username%', '%dotmailer_password%', '%dotmailer_uri%']

Dotmailer\Dotmailer:
   arguments: ['@Dotmailer\Adapter']

Coverage

Currently the following endpoints are covered:

  • Address books
    • Get address books
  • Campaigns
    • Get all campaigns
    • Get campaign
  • Contacts
    • Create contact
    • Delete contact
    • Update contact
    • Add contact to address book
    • Delete contact from address book
    • Get contact by email
    • Get contact address books
    • Get unsubscribed contacts since date
    • Unsubscribe contact
    • Resubscribe contact
    • Resubscribe contact to adress books
  • Contact data fields
    • Create contact data field
    • Delete contact data field
  • Programs
    • Get programs
    • Create program enrolment
  • Transactional email
    • Send transactional email
    • Send transactional email using a triggered campaign