otis22/transactional

1.0.52 2023-10-02 11:40 UTC

This package is auto-updated.

Last update: 2024-12-01 00:14:07 UTC


README

Mailchimp Developer

WARNING!!!

Fork for a PHP ^8.0 support

Original repo mailchimp/mailchimp-transactional-php.

How to fix mailchimp/mailchimp-transactional-php for work with php8

composer rm mailchimp/transactional
composer require otis22/transactional

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": {
    "otis22/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: