Mailchimp API Helper - Laravel Library (MailchimpHelper)
Worked on Mailchimp API v3
- Get List
- Check the status of a contact
- Subscribe a user to your list with merge fields and double-opt-in confirmation disabled
- View Tags
- Add New Tag
- Add a tag to a contact
- View tags in a contact
Set Mailchimp configurations in .env
file
...
MC_KEY=xxx
MC_LIST_ID=xxx
MC_TAG_DEFAULT=xxx
...
- MC_KEY = Mailchimp API key
- MC_LIST_ID = Mailchimp List ID
- MC_TAG_DEFAULT = Mailchimp Tag ID as default
Copy MailchimpHelper.php
to your Laravel project - for sample copy then paste in app/Libraries
In your Controller file, please include the MailchimpHelper library
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
// USE LIBRARIES
use App\Libraries\MailchimpHelper;
class XxxController extends Controller
{
....
How to call the function in MailchimpHelper library
public function mailchimp_subscribe(Request $request)
{
// SET THE PARAMETERS
$email_address = $request->input('email');
$result = MailchimpHelper::add_subscribe($email_address);
dd($result);
}
For sample, please check DevController.php
Thank you for considering contributing to the MailchimpHelper.
If you discover a bug or security vulnerability within MailchimpHelper, please send an email to Vicky Budiman at [email protected]. All requests will be addressed promptly.
If you come across any issue/bug please report them here.
MailchimpHelper is open-sourced software built by KINIDI Tech and contributors and licensed under the MIT license.
- Vicky Budiman (https://github.com/vickzkater)
- NZTim (https://github.com/nztim/mailchimp)
Brought to you by
KINIDI Tech