2017 © Pedro PelĆ”ez
 

library mailchimp-api-v3

Simple API wrapper for Mailchimp API version 3

image

adrian7/mailchimp-api-v3

Simple API wrapper for Mailchimp API version 3

  • Thursday, November 2, 2017
  • by adrian7
  • Repository
  • 1 Watchers
  • 0 Stars
  • 39 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 23 Forks
  • 0 Open issues
  • 11 Versions
  • 0 % Grown

The README.md

PHP Wrapper for MailChimp API v3 CircleCI

Installation

composer require adrian7/mailchimp-api-v3

Usage

There's one method to rule them all:, (*1)

// $arguments is used as POST data or GET parameters, depending on the method used.
request($resource, $arguments = [], $method = 'GET')

But its clever enough to map these calls aswell:, (*2)

get($resource, array $options = [])
head($resource, array $options = [])
put($resource, array $options = [])
post($resource, array $options = [])
patch($resource, array $options = [])
delete($resource, array $options = [])

Pagination

We use offset and count in the query string to paginate data, because it provides greater control over how you view your data. Offset defaults to 0, so if you use offset=1, you'll miss the first element in the dataset. Count defaults to 10., (*3)

Source: http://kb.mailchimp.com/api/article/api-3-overview, (*4)

Filtering

Most endpoints don't currently support filtering, but we plan to add these capabilities over time. Schemas will tell you which collections can be filtered, and what to include in your query string., (*5)

Source: http://kb.mailchimp.com/api/article/api-3-overview, (*6)

Partial Response

To cut down on data transfers, pass a comma separated list of fields to include or exclude from a certain response in the query string. The parameters fields and exclude_fields are mutually exclusive and will throw an error if a field isn't valid in your request., (*7)

Source: http://kb.mailchimp.com/api/article/api-3-overview, (*8)

Behind Proxy

If you are behind a proxy, you can use setProxy directly on the class., (*9)

setProxy(host : string, port : int, [ssl : bool = false], [username = null], [password = null]);, (*10)

See the example., (*11)

Examples

All queries will return an object containing the parsed json response., (*12)

$mc = new Mailchimp('<api-key>', '<guzzle-options[array]>');

// Get 10 lists starting from offset 10 and include only a specific set of fields
$result = $mc->request('lists', [
    'fields' => 'lists.id,lists.name,lists.stats.member_count',
    'offset' => 10,
    'count' => 10
]);

// Will fire this query: 
// GET https://us1.api.mailchimp.com/3.0/lists?fields=lists.id,lists.name,lists.stats.member_count&count=10

var_dump($result);

Create list

// All these fields are required to create a new list.
$result = $mc->post('lists', [
    'name' => 'New list',
    'permission_reminder' => 'You signed up for updates on mailchimp-api-v3.',
    'email_type_option' => false,
    'contact' => [
        'company' => 'Doe Ltd.',
        'address1' => 'DoeStreet 1',
        'address2' => '',
        'city' => 'Doesy',
        'state' => 'Doedoe',
        'zip' => '1672-12',
        'country' => 'US',
        'phone' => '55533344412'
    ],
    'campaign_defaults' => [
        'from_name' => 'John Doe',
        'from_email' => 'john@doe.com',
        'subject' => 'My new campaign!',
        'language' => 'US'
    ]
]);

Subresources

$result = $mc->get('lists/e04d611199', [
    'fields' => 'id,name,stats.member_count'
]);

Proxy

$mc->setProxy('https://127.0.0.1', 10, true, 'username', 'password');

$result = $mc->get('lists/e04d611199', [
    'fields' => 'id,name,stats.member_count'
]);

Further documentation

You should read through Mailchimp's API v3 documentation., (*13)

The Versions

02/11 2017

dev-master

9999999-dev

Simple API wrapper for Mailchimp API version 3

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adrian Șilimon-Morariu

api php mailchimp v3

31/08 2017

v1.0.8

1.0.8.0

Simple API wrapper for Mailchimp API version 3

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adrian Șilimon-Morariu

api php mailchimp v3

28/08 2017

v1.0.7

1.0.7.0

Simple API wrapper for Mailchimp API version 3

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adrian Șilimon-Morariu

api php mailchimp v3

06/01 2017

dev-binding-arguments-installable

dev-binding-arguments-installable

Simple API wrapper for Mailchimp API V3

  Sources   Download

MIT

The Requires

 

The Development Requires

api php mailchimp v3

06/01 2017

dev-binding-arguments

dev-binding-arguments

Simple API wrapper for Mailchimp API V3

  Sources   Download

MIT

The Requires

 

The Development Requires

api php mailchimp v3

02/08 2016

v1.0.6

1.0.6.0

Simple API wrapper for Mailchimp API V3

  Sources   Download

MIT

The Requires

 

The Development Requires

api php mailchimp v3

24/01 2016

v1.0.5

1.0.5.0

Simple API wrapper for Mailchimp API V3

  Sources   Download

MIT

The Requires

 

The Development Requires

api php mailchimp v3

21/11 2015

v1.0.4

1.0.4.0

Simple API wrapper for Mailchimp API V3

  Sources   Download

MIT

The Requires

 

The Development Requires

api php mailchimp v3

25/07 2015

dev-laravel-provider

dev-laravel-provider

Simple API wrapper for Mailchimp API V3

  Sources   Download

MIT

The Requires

 

The Development Requires

api php mailchimp v3

25/07 2015

v1.0.3

1.0.3.0

Simple API wrapper for Mailchimp API V3

  Sources   Download

MIT

The Requires

 

The Development Requires

api php mailchimp v3

25/07 2015

v1.0.2

1.0.2.0

Simple API wrapper for Mailchimp API V3

  Sources   Download

MIT

The Requires

 

The Development Requires

api php mailchimp v3