PHPackages                             mailmotor/mailmotor-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. [Mail &amp; Notifications](/categories/mail)
4. /
5. mailmotor/mailmotor-bundle

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

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

This Symfony bundle loads in MailMotor as a service. So you can subscribe/unsubscribe members to any mailinglist managing API. F.e.: MailChimp, CampaignMonitor, ...

4.0.3(1y ago)3201.2k—6.7%6[1 issues](https://github.com/mailmotor/mailmotor-bundle/issues)3MITPHPPHP ^7.4||^8.0

Since Nov 27Pushed 1y ago1 watchersCompare

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

READMEChangelog (10)Dependencies (3)Versions (38)Used By (3)

MailMotorBundle
===============

[](#mailmotorbundle)

[![Latest Stable Version](https://camo.githubusercontent.com/da58c88bf74e9fb6c8e37318d33dd68c0213b5c60f9094e99a28635cff42ca3d/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d61696c6d6f746f722f6d61696c6d6f746f722d62756e646c652e737667)](https://packagist.org/packages/mailmotor/mailmotor-bundle)[![License](https://camo.githubusercontent.com/5a911ddcd16b9110e7821386ffd8d637005a8b856c14a3c0861b955e91da4eba/687474703a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d6c69676874677265792e737667)](https://github.com/mailmotor/mailmotor-bundle/blob/master/LICENSE)[![Build Status](https://camo.githubusercontent.com/5bf3d579e9ac96f98f7d7f8e3ba83460444395110eea3fa64958e3689372bd56/68747470733a2f2f7472617669732d63692e6f72672f6d61696c6d6f746f722f6d61696c6d6f746f722d62756e646c652e7376673f6272616e63683d6e65772d76657273696f6e)](https://travis-ci.org/mailmotor/mailmotor-bundle)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/def5757775f08d5193a37930c02a10385822b864522744f8768dbd6a43d1b6e2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d61696c6d6f746f722f6d61696c6d6f746f722d62756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mailmotor/mailmotor-bundle/?branch=master)

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

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

[](#installation)

### How to configure MailChimp

[](#how-to-configure-mailchimp)

```
composer require mailmotor/mailchimp-bundle
```

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

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

Examples
--------

[](#examples)

### 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/mailchimp-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

48

—

FairBetter than 95% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 92.2% 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 ~103 days

Recently: every ~621 days

Total

34

Last Release

413d ago

Major Versions

0.1.0 → 1.0.02015-11-27

1.8.0 → 2.0.02016-12-01

2.0.2 → 3.0.02017-06-20

3.0.5 → 4.0.02023-03-02

PHP version history (4 changes)0.1.0PHP &gt;=5.3.3

2.0.2PHP &gt;=5.3.3|^7.0

3.0.0PHP ^7.1

4.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 (106 commits)")[![carakas](https://avatars.githubusercontent.com/u/3634654?v=4)](https://github.com/carakas "carakas (5 commits)")[![alessandrocraeye](https://avatars.githubusercontent.com/u/33480369?v=4)](https://github.com/alessandrocraeye "alessandrocraeye (3 commits)")[![yukoff](https://avatars.githubusercontent.com/u/1076681?v=4)](https://github.com/yukoff "yukoff (1 commits)")

---

Tags

campaign-monitormail-enginemailchimpmailinglistphpsymfony-bundlephpsymfonybundle

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[redjanym/fcm-bundle

A Symfony Bundle for projects to send notifications in mobile devices through Firebase Cloud Messaging HTTP V1 API

43453.0k](/packages/redjanym-fcm-bundle)[php-flasher/flasher-symfony

Integrate flash notifications into Symfony projects effortlessly with PHPFlasher. Improve user experience and application feedback loops easily.

141.3M20](/packages/php-flasher-flasher-symfony)[prooph/service-bus-symfony-bundle

88392.2k3](/packages/prooph-service-bus-symfony-bundle)[railsware/mailtrap-php

The Mailtrap SDK provides methods for all API functions.

56770.5k](/packages/railsware-mailtrap-php)[harmbandstra/swagger-ui-bundle

Exposes swagger UI inside your Symfony project through a route (eg. /docs)

42867.3k](/packages/harmbandstra-swagger-ui-bundle)[robertotru/to-inline-style-email-bundle

A Symfony2 bundle for using the CssToInlineStyles translator by tijsverkoyen

59384.3k](/packages/robertotru-to-inline-style-email-bundle)

PHPackages © 2026

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