Download the PHP package sreedev/laravel-mailchimp without Composer
On this page you can find all versions of the php package sreedev/laravel-mailchimp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-mailchimp
laravel-mailchimp - MailChimp API V3
Super-simple, minimum abstraction MailChimp API v3 library for Laravel
Please refer MailChimp API docs to get to know more about the methods available
Requires PHP 7.2+
Installation
You can install laravel-mailchimp using Composer:
You will then need to:
- run
composer install
to get these dependencies added to your vendor directory - publish the config to your application with this line:
php artisan vendor:publish --provider="Sreedev\MailChimp\MailChimpServiceProvider" --tag="config"
- set the
MAIL_CHIMP_API_KEY="<YOUR_API_KEY>"
in the .env file
Examples
Start by use
-ing the library by adding use
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 this enables you to complete multiple operations with a single call. Eg: Adding thousands of members to a list - you can perform this in one request rather than thousands.
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 process 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 (in JSON format) from the URL given in the response.
Troubleshooting
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.
Contributing
This is a simple wrapper, but contributions can make it beeter. 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.