Download the PHP package djuki/mailchimp-apiv3 without Composer
On this page you can find all versions of the php package djuki/mailchimp-apiv3. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package mailchimp-apiv3
Mailchimp API v3 - PHP Wrapper
- Installation
- Laravel Users
- Service Provider
- Facade
- Configuration
- Usage
- Pagination
- Filtering
- Partial Response
- Behind Proxy
- Examples
- Collection object
- Create lists
- Subresources
- Proxy
- Further documentation
Installation
Add the following to your composer.json
Laravel Users
We've added some classes to help Laravel 5 users make use of the library with ease.
Service Provider
You can register our service provider in your app.php
config file.
Facade
If you prefer facades, make sure you add this as well:
NOTE: Make sure not to register the facade with the Mailchimp
alias, as that could potentially clash with the base class.
Configuration
There are only one configuration option you need to fill in. Publish the config by running:
php artisan vendor:publish
Now, the config file will be located under config/mailchimp.php
:
Usage
There's one method to rule them all:
But its clever enough to map these calls aswell:
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.
Source: http://kb.mailchimp.com/api/article/api-3-overview
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.
Source: http://kb.mailchimp.com/api/article/api-3-overview
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._
Source: http://kb.mailchimp.com/api/article/api-3-overview
Behind Proxy
If you are behind a proxy, you can use setProxy
directly on the class.
setProxy(host : string, port : int, [ssl : bool = false], [username = null], [password = null]);
See the example.
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()
.
You can use a simple foreach/for loop or use the built in each(callable $callback)
provided by our Collection object to loop through your items.
There's alot more you can do with the Collection object.
Create lists
Subresources
Proxy
Further documentation
You should read through Mailchimp's API v3 documentation (I know, it's pretty rough. Should get better soon.). To find out which resources is available, take a look at the JSON API Schema for Mailchimp.