2017 © Pedro Peláez
 

library mailchimpv3

Mailchimp API V3 API Wrapper for Laravel 4

image

asanzred/mailchimpv3

Mailchimp API V3 API Wrapper for Laravel 4

  • Thursday, October 20, 2016
  • by asanzred
  • Repository
  • 1 Watchers
  • 2 Stars
  • 172 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 81 % Grown

The README.md

Mailchimp API V3 API Wrapper for Laravel 4

Installation

Add the following to your composer.json, (*1)

{
    "require": {
        "asanzred/mailchimpv3": "dev-master"
    }
}

Add ServiceProvider in your app.php config file., (*2)

// config/app.php
'providers' => [
    ...
    'Asanzred\Mailchimpv3\Mailchimpv3ServiceProvider'
]

and instead on aliases, (*3)

// config/app.php
'aliases' => [
    ...
    'Mailchimpv3' => 'Asanzred\Mailchimpv3\Facades\Mailchimpv3'
]

Configuration

Publish the config by running:, (*4)

php artisan config:publish asanzred/mailchimpv3

Now, the config file will be located under config/asanzred/mailchimpv3/config.php:, (*5)

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Mailchimp API key
    |--------------------------------------------------------------------------
    |
    | To obtain an API key, go to mailchimp.com under your profile
    | you will find Extras -> API keys. Paste the key below.
    |
    */
    'apikey' => ''
];

Usage

There's only one method:, (*6)

request($resource, $arguments = [], $method = 'GET') 

You can make these calls if needed, (*7)

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., (*8)

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

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., (*10)

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

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., (*12)

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

Behind Proxy

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

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

Examples

Collection object

All queries will return an instance of the Illuminate\Support\Collection object, which is really easy to work with. If you don't want to use the Collection object however, you can transform it into an array using $result->toArray()., (*16)


$resource = '/lists/' $result = Mailchimpv3::request($resource, $opts,'GET'); // Returns object(Illuminate\Support\Collection) var_dump($result); // Returns the first item var_dump($result->first()); // Returns 3 items var_dump($result->take(3)); // Returns a JSON string var_dump($result->toJson()); // Returns an array var_dump($result->toArray());

The Versions

20/10 2016

dev-master

9999999-dev

Mailchimp API V3 API Wrapper for Laravel 4

  Sources   Download

MIT

The Requires

 

laravel api php mailchimp v3

05/02 2016

dev-develop

dev-develop

Mailchimp API V3 API Wrapper for Laravel 4

  Sources   Download

MIT

The Requires

 

laravel api php mailchimp v3