mailchimp/transactional

1.0.59 2024-02-10 01:12 UTC

README

Mailchimp Developer

Mailchimp Transactional — PHP

The official PHP client library for the Mailchimp Transactional API (v1)

Installation

Option 1: Install via Packagist

composer require mailchimp/transactional

Or add the following to composer.json

{
  "require": {
    "mailchimp/transactional": "*"
  }
}

Install all composer dependencies using:

composer install

Option 2: Install Manually

Clone the repo

git clone git@github.com:mailchimp/mailchimp-transactional-php.git

In the project root, install all dependencies

composer install

Manually include vendor/autoload.php in your implementation

require_once('/path/to/MailchimpTransactional/vendor/autoload.php');

Quick Start

Note that this SDK requires PHP 7.2 or above.

require_once('/path/to/MailchimpTransactional/vendor/autoload.php');

$mailchimp = new MailchimpTransactional\ApiClient();
$mailchimp->setApiKey('YOUR_API_KEY');

$response = $mailchimp->users->ping();
print_r($response);

Sending Requests

All requests are sent via POST and accept a single argument as the request body parameter.

$mailchimp->templates->publish([ 'name' => 'My Template']);

Output Formats

Optionally, you can set the default response format for all requests to one of the following:

  • json (default)
  • xml
  • php
  • yaml
$mailchimp->setDefaultOutputFormat('xml');

You can also set the response format for a single request by passing in a special outputFormat param to the request body.

$mailchimp->senders->list([ 'outputFormat' => 'php']);

PRs and Issues

This repo is autogenerated from https://github.com/mailchimp/mailchimp-client-lib-codegen -- please submit PRs or issues there!

API Endpoints

All URIs are relative to https://mandrillapp.com/api/1.0

Additional Libraries

Mailchimp Transactional libraries are available in the following languages: