PHP client library for the Dotmailer REST API (v2) described at https://developer.dotmailer.com/docs/
composer require wellcometrust/dotmailer-php
<?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']
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