luyadev/mailchimp-marketing-php

1.0.0 2024-01-03 14:24 UTC

This package is auto-updated.

Last update: 2024-11-03 16:14:56 UTC


README

Mailchimp Developer

Mailchimp Marketing — PHP

The unofficial PHP client library for the Mailchimp Marketing API *which works with PHP 8.2"

Installation

Option 1: Install via Packagist

composer require luyadev/mailchimp-marketing-php

Or add the following to composer.json

{
  "require": {
    "luyadev/mailchimp-marketing-php": "^1.0"
  }
}

Install all composer dependencies using:

composer install

Option 2: Install Manually

Clone the repo

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

In the client library project root, install all dependencies

composer install

Manually include vendor/autoload.php in your implementation

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

Quick Start

Note that this SDK requires PHP 7.2 or above.

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

$mailchimp = new MailchimpMarketing\ApiClient();

$mailchimp->setConfig([
  'apiKey' => 'YOUR_API_KEY',
  'server' => 'YOUR_SERVER_PREFIX'
]);

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

Authentication Methods

The client library can be configured to use either Basic Auth or OAuth2.

For either method, a server prefix should be passed in i.e. us19, in order for the client to determine to appropriate host url.

Basic Auth

$mailchimp->setConfig([
  'apiKey' => 'YOUR_API_KEY',
  'server' => 'YOUR_SERVER_PREFIX'
]);

OAuth2

$mailchimp->setConfig([
  'accessToken' => 'YOUR_ACCESS_TOKEN',
  'server' => 'YOUR_SERVER_PREFIX'
]);

PRs and Issues

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

Other configuration options

The APIClient class lets you set various configuration options like timeouts, host, user agent, and debug output. See https://github.com/mailchimp/mailchimp-marketing-php/blob/master/lib/Configuration.php for more details.

API Endpoints

All URIs are relative to https://server.api.mailchimp.com/3.0

Additional Libraries

Mailchimp Marketing libraries are available in the following languages: