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. locomotivemtl/charcoal-contrib-mailchimp

ActiveLibrary

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 1mo 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 today

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

35

—

LowBetter than 81% of packages

Maintenance61

Regular maintenance activity

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

2298d 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

[locomotivemtl/charcoal-cms

Charcoal CMS (Content Management System) Module

529.0k3](/packages/locomotivemtl-charcoal-cms)[locomotivemtl/charcoal-app

Charcoal application, based on Slim 3

1320.3k11](/packages/locomotivemtl-charcoal-app)

PHPackages © 2026

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