PHPackages                             locomotivemtl/charcoal-contrib-mailchimp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. locomotivemtl/charcoal-contrib-mailchimp

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

locomotivemtl/charcoal-contrib-mailchimp
========================================

Charcoal service provider for mailchimp implementation.

0.2.0(6y ago)0362↓100%[1 PRs](https://github.com/locomotivemtl/charcoal-contrib-mailchimp/pulls)MITPHPPHP &gt;=5.6.0 || &gt;=7.0CI failing

Since Jun 14Pushed 3mo ago13 watchersCompare

[ Source](https://github.com/locomotivemtl/charcoal-contrib-mailchimp)[ Packagist](https://packagist.org/packages/locomotivemtl/charcoal-contrib-mailchimp)[ Docs](https://locomotivemtl.github.io/charcoal-contrib-mailchimp/)[ RSS](/packages/locomotivemtl-charcoal-contrib-mailchimp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (5)Used By (0)

Charcoal Mailchimp
==================

[](#charcoal-mailchimp)

[![License](https://camo.githubusercontent.com/6c56013c38daedfbe0e31139b4169eaa89d0537c853639ba2b0b93ec2487d13c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c6f636f6d6f746976656d746c2f63686172636f616c2d636f6e747269622d6d61696c6368696d702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/locomotivemtl/charcoal-contrib-mailchimp)[![Latest Stable Version](https://camo.githubusercontent.com/891fd8e4b74ad3c3355ee7b2ce6e4c5951fcb407f0f18e526fde2557086fe729/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6f636f6d6f746976656d746c2f63686172636f616c2d636f6e747269622d6d61696c6368696d702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/locomotivemtl/charcoal-contrib-mailchimp)[![Code Quality](https://camo.githubusercontent.com/8c140ad8e3146e7a9208ed0be923187c688d15ede7c6920469016350b142e380/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6c6f636f6d6f746976656d746c2f63686172636f616c2d636f6e747269622d6d61696c6368696d702e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/locomotivemtl/charcoal-contrib-mailchimp/)[![Coverage Status](https://camo.githubusercontent.com/32a1b1ac51f99efd32785e662d38d1c58c621808cdfb5feb1be37c2bd93ac33a/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6c6f636f6d6f746976656d746c2f63686172636f616c2d636f6e747269622d6d61696c6368696d702e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/r/locomotivemtl/charcoal-contrib-mailchimp)[![Build Status](https://camo.githubusercontent.com/e891078447378b4e3cf28e16708a564ba9e626d68a7b8aa0d9110248af8add49/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6c6f636f6d6f746976656d746c2f63686172636f616c2d636f6e747269622d6d61696c6368696d702e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/locomotivemtl/charcoal-contrib-mailchimp)

A [Charcoal](https://packagist.org/packages/locomotivemtl/charcoal-app) service provider mailchimp implementation.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
    - [Dependencies](#dependencies)
- [Service Provider](#service-provider)
    - [Parameters](#parameters)
    - [Services](#services)
- [Configuration](#configuration)
- [Usage](#usage)
- [Development](#development)
    - [API Documentation](#api-documentation)
    - [Development Dependencies](#development-dependencies)
    - [Coding Style](#coding-style)
- [Credits](#credits)
- [License](#license)

Installation
------------

[](#installation)

The preferred (and only supported) method is with Composer:

```
$ composer require locomotivemtl/charcoal-contrib-mailchimp
```

### Dependencies

[](#dependencies)

#### Required

[](#required)

- [**PHP 5.6+**](https://php.net): *PHP 7* is recommended.

Configuration
-------------

[](#configuration)

Include the mailchimp module in the projects's config file. This will provide everything needed for [charcoal-contrib-mailchimp](https://packagist.org/packages/locomotivemtl/charcoal-contrib-mailchimp) to work properly.

```
{
    "modules": {
       "charcoal/mailchimp/mailchimp": {}
    }
}
```

Add the api key (Account &gt; Settings &gt; Extra &gt; Api keys) in the config apis:

```
"apis": {
    "mailchimp": {
        "key": "myapikey-usXX"
    }
}
```

Usage
-----

[](#usage)

[charcoal-contrib-mailchimp](https://packagist.org/packages/locomotivemtl/charcoal-contrib-mailchimp) comes with a set of tools to help setup a newsletter subscription.

### Properties

[](#properties)

There are 2 different property types you can use to either select an audience or a signup form for a given audience.

#### Mailchimp List

[](#mailchimp-list)

Set your property as follow.

```
    "type": "string",
    "input_type": "charcoal/admin/property/input/mailchimp-list",
    "mailchimp_options": {
        "query_parameters": {
            "count": 20
        }
    }
```

You can customize the displayed label, the displayed title, the value and the subtext pattern. It is also possible to add query parameters (see [Doc](https://developer.mailchimp.com/documentation/mailchimp/reference/lists/#%20)) Default as follow:

```
"mailchimp_options": {
    "title_pattern": "{{name}}",
    "value_pattern": "{{id}}",
    "label_pattern": "{{name}}",
    "subtext_pattern": "Web ID: {{id}}",
    "query_parameters": []
}
```

#### Mailchimp Signup Form

[](#mailchimp-signup-form)

```
    "type": "string",
    "input_type": "charcoal/admin/property/input/mailchimp-form",
    "mailchimp_options": {
        [...]
    }
```

You can customize the displayed label, the displayed title, the value and the subtext pattern. Default as follow:

```
"mailchimp_options": {
    "title_pattern": "{{header.text}}",
    "value_pattern": "{{signup_form_url}}",
    "label_pattern": "{{header.text}}",
    "subtext_pattern": "Form URL: {{signup_form_url}}"
}
```

### User subscription

[](#user-subscription)

```
class FooBar
{
    use MailchimpAwareTrait;
    [...]

    public function setDependencies(Container $container)
    {
        $this->setMailchimpListsMembers($container['mailchimp/lists/members']);
        [...]
    }

    public function run()
    {
        $user = [
            'email_address' => 'email@example.com',
            'status' => 'pending',
            'merge_fields' => [
                'FNAME' => 'John',
                'LNAME' => 'Doe'
            ]
        ];

        // Set list ID
        $listId = 'a4029db2d';
        $this->mailchimpListsMembers()->setListId($listId);

        // Add/Create user
        $results = $this->mailchimpListsMembers()->add($user);

        // Add or Update user
        $results = $this->mailchimpListsMembers()->addOrUpdate($user);

        // Get a user's informations
        $results = $this->mailchimpListsMembers()->get('email@example.com');

        // Delete a user from a list
        $results = $this->mailchimpListsMembers()->remove('email@example.com');
    }
}
```

The mailchimp service is standalone and can be used directly if you know the endpoints by using the post, patch, get, put and delete methods.

```
// Get lists members
$this->mailchimp()->get('lists/{list_id}/members');

// Add member to list
$this->mailchimp()->post('list/{list_id}/members', [
    'email_address' => 'email@example.com',
    'status' => 'pending'
]);
```

Coding Style
------------

[](#coding-style)

The charcoal-contrib-mailchimp module follows the Charcoal coding-style:

- [*PSR-1*](https://www.php-fig.org/psr/psr-1/)
- [*PSR-2*](https://www.php-fig.org/psr/psr-2/)
- [*PSR-4*](https://www.php-fig.org/psr/psr-4/), autoloading is therefore provided by *Composer*.
- [*phpDocumentor*](http://phpdoc.org/) comments.
- [phpcs.xml.dist](phpcs.xml.dist) and [.editorconfig](.editorconfig) for coding standards.

> Coding style validation / enforcement can be performed with `composer phpcs`. An auto-fixer is also available with `composer phpcbf`.

Credits
-------

[](#credits)

- [Locomotive](https://locomotive.ca/)

License
-------

[](#license)

Charcoal is licensed under the MIT license. See [LICENSE](LICENSE) for details.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance55

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~87 days

Total

3

Last Release

2349d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f3f29e38395113e2400bdd7e51bea982b17f120d4d5a53d4473b53118ee46f8d?d=identicon)[JoelAlphonso](/maintainers/JoelAlphonso)

---

Top Contributors

[![JoelAlphonso](https://avatars.githubusercontent.com/u/10762266?v=4)](https://github.com/JoelAlphonso "JoelAlphonso (4 commits)")[![BeneRoch](https://avatars.githubusercontent.com/u/3017380?v=4)](https://github.com/BeneRoch "BeneRoch (1 commits)")

---

Tags

charcoal

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/locomotivemtl-charcoal-contrib-mailchimp/health.svg)

```
[![Health](https://phpackages.com/badges/locomotivemtl-charcoal-contrib-mailchimp/health.svg)](https://phpackages.com/packages/locomotivemtl-charcoal-contrib-mailchimp)
```

###  Alternatives

[tijsverkoyen/css-to-inline-styles

CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.

5.8k505.3M227](/packages/tijsverkoyen-css-to-inline-styles)[minishlink/web-push

Web Push library for PHP

1.9k12.0M53](/packages/minishlink-web-push)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[spatie/url-signer

Generate a url with an expiration date and signature to prevent unauthorized access

4422.3M16](/packages/spatie-url-signer)[mattketmo/email-checker

Throwaway email detection library

2742.0M5](/packages/mattketmo-email-checker)[netflie/laravel-notification-whatsapp

Laravel notification driver for WhatsApp

176173.9k](/packages/netflie-laravel-notification-whatsapp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
