Download the PHP package drewm/mailchimp-api without Composer

On this page you can find all versions of the php package drewm/mailchimp-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.


After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mailchimp-api

MailChimp API

Super-simple, minimum abstraction MailChimp API v3 wrapper, in PHP.

I hate complex wrappers. This lets you get from the MailChimp API docs to the code as directly as possible.

Requires PHP 5.3 and a pulse. Abstraction is for chimps.

Build Status Scrutinizer Code Quality Packagist


You can install mailchimp-api using Composer:

You will then need to:

Alternatively you can just download the MailChimp.php file and include it manually:

If you wish to use the batch request or webhook interfaces, you'll also need to download and include the Batch.php or Webhook.php files:

These are optional. If you're not using batches or webhooks you can just skip them. You can always come back and add them later.


Start by use-ing the class and creating an instance with your API key

Then, list all the mailing lists (with a get on the lists method)

Subscribe someone to a list (with a post to the lists/{listID}/members method):

Update a list member with more information (using patch to update):

Remove a list member using the delete method:

Quickly test for a successful action with the success() method:

Batch Operations

The MailChimp Batch Operations functionality enables you to complete multiple operations with a single call. A good example is adding thousands of members to a list - you can perform this in one request rather than thousands.

You can then make requests on the Batch object just as you would normally with the MailChimp object. The difference is that you need to set an ID for the operation as the first argument, and also that you won't get a response. The ID is used for finding the result of this request in the combined response from the batch operation.

Once you've finished all the requests that should be in the batch, you need to execute it.

The result includes a batch ID. At a later point, you can check the status of your batch:

When your batch is finished, you can download the results from the URL given in the response. In the JSON, the result of each operation will be keyed by the ID you used as the first argument for the request.


Note: Use of the Webhooks functionality requires at least PHP 5.4.

MailChimp webhooks enable your code to be notified of changes to lists and campaigns.

When you set up a webhook you specify a URL on your server for the data to be sent to. This wrapper's Webhook class helps you catch that incoming webhook in a tidy way. It uses a subscription model, with your code subscribing to whichever webhook events it wants to listen for. You provide a callback function that the webhook data is passed to.

To listen for the unsubscribe webhook:

At first glance the subscribe/unsubscribe looks confusing - your code is subscribing to the MailChimp unsubscribe webhook event. The callback function is passed as single argument - an associative array containing the webhook data.

If you'd rather just catch all webhooks and deal with them yourself, you can use:

There doesn't appear to be any documentation for the content of the webhook data. It's helpful to use something like ngrok for tunneling the webhooks to your development machine - you can then use its web interface to inspect what's been sent and to replay incoming webhooks while you debug your code.


To get the last error returned by either the HTTP client or by the API, use getLastError():

For further debugging, you can inspect the headers and body of the response:

If you suspect you're sending data in the wrong format, you can look at what was sent to MailChimp by the wrapper:

If your server's CA root certificates are not up to date you may find that SSL verification fails and you don't get a response. The correction solution for this is not to disable SSL verification. The solution is to update your certificates. If you can't do that, there's an option at the top of the class file. Please don't just switch it off without at least attempting to update your certs -- that's lazy and dangerous. You're not a lazy, dangerous developer are you?

If you have high-level implementation questions about your project ("How do I add this to WordPress", "I've got a form that takes an email address...") please take them to somewhere like StackOverflow. If you think you've found a bug, or would like to discuss a change or improvement, feel free to raise an issue and we'll figure it out between us.


This is a fairly simple wrapper, but it has been made much better by contributions from those using it. If you'd like to suggest an improvement, please raise an issue to discuss it before making your pull request.

Pull requests for bugs are more than welcome - please explain the bug you're trying to fix in the message.

There are a small number of PHPUnit unit tests. Unit testing against an API is obviously a bit tricky, but I'd welcome any contributions to this. It would be great to have more test coverage.

All versions of mailchimp-api with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3
ext-curl Version *
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package drewm/mailchimp-api contains the following files

Loading the files please wait ....