PHPackages                             mailmotor/campaignmonitor-bundle - 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. mailmotor/campaignmonitor-bundle

ActiveLibrary

mailmotor/campaignmonitor-bundle
================================

This Symfony2 bundle loads in CampaignMonitor as a service. So you can subscribe/unsubscribe members to CampaignMonitor.

3.0.0(3y ago)3195.4k—8.3%31MITPHPPHP ^7.4||^8.0

Since Nov 30Pushed 3y ago2 watchersCompare

[ Source](https://github.com/mailmotor/campaignmonitor-bundle)[ Packagist](https://packagist.org/packages/mailmotor/campaignmonitor-bundle)[ Docs](https://github.com/mailmotor/campaignmonitor-bundle)[ RSS](/packages/mailmotor-campaignmonitor-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (3)Versions (9)Used By (1)

CampaignMonitorBundle
=====================

[](#campaignmonitorbundle)

[![Latest Stable Version](https://camo.githubusercontent.com/3cf709573f321f87fc34e27a638fb48392b25f75fc65d2c375d4f832c2590cce/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d61696c6d6f746f722f63616d706169676e6d6f6e69746f722d62756e646c652e737667)](https://packagist.org/packages/mailmotor/campaignmonitor-bundle)[![License](https://camo.githubusercontent.com/5a911ddcd16b9110e7821386ffd8d637005a8b856c14a3c0861b955e91da4eba/687474703a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d6c69676874677265792e737667)](https://github.com/mailmotor/campaignmonitor-bundle/blob/master/LICENSE)[![Build Status](https://camo.githubusercontent.com/271891852d053744ae6904ac501f2d63036e0efc2d61a063563cd8f7541b8f21/68747470733a2f2f7472617669732d63692e6f72672f6d61696c6d6f746f722f63616d706169676e6d6f6e69746f722d62756e646c652e7376673f6272616e63683d6e65772d76657273696f6e)](https://travis-ci.org/mailmotor/campaignmonitor-bundle)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/20c7a8d4be78eafd64e85bf82441c0cea4bef112c3f8dbf302b847e0dee844d8/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d61696c6d6f746f722f63616d706169676e6d6f6e69746f722d62756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mailmotor/campaignmonitor-bundle/?branch=master)

> Subscribing/Unsubscribing to your own mailinglist has never been this easy! Thanks to this Symfony2 bundle.

Examples
--------

[](#examples)

### Configure (CampaignMonitor)

[](#configure-campaignmonitor)

```
composer require mailmotor/campaignmonitor-bundle
```

```
// In `app/AppKernel.php`
public function registerBundles()
{
    $bundles = array(
        // ...
        new MailMotor\Bundle\MailMotorBundle\MailMotorMailMotorBundle(),
        new MailMotor\Bundle\CampaignMonitorBundle\MailMotorCampaignMonitorBundle(),
    );
```

```
# In `app/config/parameters.yml`
parameters:
    # ...
    mailmotor.mail_engine:  'campaignmonitor'
    mailmotor.api_key:      xxx # enter your campaignmonitor api_key here
    mailmotor.list_id:      xxx # enter the campaignmonitor default list_id here
```

### Subscribing

[](#subscribing)

```
$this->get('mailmotor.subscriber')->subscribe(
    $email,         // f.e.: 'info@jeroendesloovere.be'
    $language,      // f.e.: 'nl'
    $mergeFields,   // f.e.: ['FNAME' => 'Jeroen', 'LNAME' => 'Desloovere']
    $interests,     // f.e.: ['9A28948d9' => true, '8998ASAA' => false]
    $doubleOptin,   // OPTIONAL, default = true
    $listId         // OPTIONAL, default listId is in your config parameters
);
```

### Unsubscribing

[](#unsubscribing)

```
$this->get('mailmotor.subscriber')->unsubscribe(
    $email,
    $listId // OPTIONAL, default listId is in your config parameters
);
```

### Exists

[](#exists)

```
$this->get('mailmotor.subscriber')->exists(
    $email,
    $listId // OPTIONAL, default listId is in your config parameters
);
```

### Is subscribed

[](#is-subscribed)

```
$this->get('mailmotor.subscriber')->isSubscribed(
    $email,
    $listId // OPTIONAL, default listId is in your config parameters
);
```

### Full example for subscribing

[](#full-example-for-subscribing)

```
use MailMotor\Bundle\MailMotorBundle\Exception\NotImplementedException;

// Don't forget to add validation to your $email
$email = 'info@jeroendesloovere.be';

try {
    if ($this->get('mailmotor.subscriber')->isSubscribed($email)) {
        // Add error to your form
    }
// Fallback for when no mailmotor parameters are defined
} catch (NotImplementedException $e) {
    // Do nothing
}

if ($noErrors)
    try {
        // Subscribe the user to our default group
        $this->get('mailmotor.subscriber')->subscribe(
            $email,
            $language,
            $mergeFields
        );
    // Fallback for when no mailmotor parameters are defined
    } catch (NotImplementedException $e) {
        // Add you own code here to f.e.: send a mail to the admin
    }
}
```

### Full example for unsubscribing

[](#full-example-for-unsubscribing)

```
use MailMotor\Bundle\MailMotorBundle\Exception\NotImplementedException;

// Don't forget to add validation to your $email
$email = 'info@jeroendesloovere.be';

try {
    // Email exists
    if ($this->get('mailmotor.subscriber')->exists($email)) {
        // User is already unsubscribed
        if ($this->get('mailmotor.subscriber')->isUnsubscribed($email)) {
            // Add error to your form: "User is already unsubscribed"
        }
    // Email not exists
    } else {
        // Add error to your form: "email is not in mailinglist"
    }
// Fallback for when no mailmotor parameters are defined
} catch (NotImplementedException $e) {
    // Do nothing
}

if ($noErrors) {
    try {
        // Unsubscribe the user
        $this->get('mailmotor.subscriber')->unsubscribe($email);
    // Fallback for when no mailmotor parameters are defined
    } catch (NotImplementedException $e) {
        // We can send a mail to the admin instead
    }
}
```

Extending
---------

[](#extending)

### Creating a bundle for another mail engine.

[](#creating-a-bundle-for-another-mail-engine)

F.e.: You want to use a mail engine called "Crazy".

```
public function registerBundles()
{
    $bundles = array(
        // ...
        new Crazy\Bundle\MailMotorBundle\CrazyMailMotorBundle(),
    );
```

In **app/config/parameters.yml**

```
mailmotor.mail_engine:  'crazy'
mailmotor.api_key:      xxx # enter your crazy api_key here
mailmotor.list_id:      xxx # enter the crazy default list_id here
```

Then you just need to duplicate all files from another mail engine, like f.e.: "mailmotor/campaignmonitor-bundle" and replace all the logic for your own mail engine.

Credits
-------

[](#credits)

- Jeroen Desloovere - [Github](https://github.com/jeroendesloovere), [Website](http://jeroendesloovere.be)

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 91.3% 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 ~327 days

Recently: every ~572 days

Total

8

Last Release

1163d ago

Major Versions

0.2.0 → 1.0.02016-12-01

1.0.2 → 2.0.02017-06-20

2.0.1 → 3.0.02023-03-13

PHP version history (3 changes)0.0.1PHP &gt;=5.3.3

2.0.0PHP ^7.1

3.0.0PHP ^7.4||^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/588616?v=4)[Jeroen Desloovere](/maintainers/jeroendesloovere)[@jeroendesloovere](https://github.com/jeroendesloovere)

---

Top Contributors

[![jeroendesloovere](https://avatars.githubusercontent.com/u/588616?v=4)](https://github.com/jeroendesloovere "jeroendesloovere (21 commits)")[![carakas](https://avatars.githubusercontent.com/u/3634654?v=4)](https://github.com/carakas "carakas (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

campaign-monitorcampaignmonitor-bundlecmmail-enginemailinglistphpsymfony-bundlephpbundleSymfony2Campaign Monitor

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mailmotor-campaignmonitor-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/mailmotor-campaignmonitor-bundle/health.svg)](https://phpackages.com/packages/mailmotor-campaignmonitor-bundle)
```

###  Alternatives

[endroid/qr-code-bundle

Endroid QR Code Bundle

32110.6M17](/packages/endroid-qr-code-bundle)[gfreeau/get-jwt-bundle

This Symfony bundle provides a security listener to return a JWT

86591.6k3](/packages/gfreeau-get-jwt-bundle)[jeroendesloovere/vcard-bundle

This Symfony 2 bundle can generate vCards with lots of data. When using an &lt; iOS 7 device it will export as a .ics file because iOS devices don't support the default .vcf files.

1677.3k3](/packages/jeroendesloovere-vcard-bundle)[supertag/gearman-bundle

Gearman bundle for Symfony2 to manage and monitor PHP gearman jobs and queue

1441.3k](/packages/supertag-gearman-bundle)[inspector-apm/inspector-symfony

Code Execution Monitoring for Symfony applications.

2830.1k2](/packages/inspector-apm-inspector-symfony)

PHPackages © 2026

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