mabasic/mailchimp

It subscribes an email address to your mailchimp list.

Fund package maintenance!
Patreon

1.0.0 2017-12-03 00:42 UTC

This package is auto-updated.

Last update: 2024-03-29 03:20:43 UTC


README

It subscribes an email address to your mailchimp list.

Become a Patron

Overview

This package can be used as a stand-alone package with any PHP framework or as a Laravel package.

Installation

composer require mabasic/mailchimp

Usage

Laravel

First, add this to your config/services.php file:

'mailchimp' => [
    'key' => env('MAILCHIMP_KEY'),
    'dc' => env('MAILCHIMP_DATA_CENTER', 'us1')
]

Hint! You can even add your list_id above if you only use one list in your application.

Then, add the correct values in your .env file:

MAILCHIMP_KEY=
MAILCHIMP_DATA_CENTER=

Finally, do this to subscribe an address:

use Mabasic\Mailchimp\Facade as Mailchimp;

Mailchimp::subscribeAnAddress($list_id, $email);

General PHP

$mailchimp = new \Mabasic\Mailchimp\Mailchimp($key, $dc);

$mailchimp->subscribeAnAddress($list_id, $email);

Tips

Read the source code for src/Mailchimp.php to better understand what $dc does and how to subscribe an address without a confirmation email. It is very educational.

Laravelista Sponsors & Backers

I would like to extend my thanks to the following sponsors & backers for funding my open-source journey. If you are interested in becoming a sponsor or backer, please visit the Laravelista Backers page.

Contributing

Thank you for considering contributing to mabasic/mailchimp! The contribution guide can be found on the Laravelista website.

Code of Conduct

In order to ensure that the Laravelista community is welcoming to all, please review and abide by the Code of Conduct.

License

mabasic/mailchimp is open-source software licensed under the MIT license.