mc-test / transactional
Requires
- php: >=5.5
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ~2.12
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ~2.6
This package is not auto-updated.
Last update: 2024-09-28 12:33:53 UTC
README
The official PHP SDK 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:postlight/mailchimp-transactional-php.git
In the SDK 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
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']);
API Endpoints
All URIs are relative to https://mandrillapp.com/api/1.0
Additional SDKs
Mailchimp Transactional SDKs are available in a number of additional languages.