PHPackages                             rezozero/subscribeme - 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. rezozero/subscribeme

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

rezozero/subscribeme
====================

Unified Email Service Library: A simple mailing list subscriber factory that includes a mailing list subscription feature and the ability to send transactional emails.

2.2.2(3w ago)72.9k↑136.7%MITPHPPHP &gt;=8.0CI passing

Since Apr 23Pushed 3w ago3 watchersCompare

[ Source](https://github.com/rezozero/subscribeme)[ Packagist](https://packagist.org/packages/rezozero/subscribeme)[ RSS](/packages/rezozero-subscribeme/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (21)Versions (17)Used By (0)

Subscribe me
============

[](#subscribe-me)

[![Static analysis and code style](https://github.com/rezozero/subscribeme/actions/workflows/run-test.yml/badge.svg)](https://github.com/rezozero/subscribeme/actions/workflows/run-test.yml)

Unified Email Service Library: A simple mailing list subscriber factory that includes a mailing list subscription feature and the ability to send transactional emails.

Supported platforms
-------------------

[](#supported-platforms)

- Mailjet
- Mailchimp (use Mandrill for transactional emails)
- Brevo (ex SendInBlue)
- Brevo DOI (Double Opt-In) (ex SendInBlue)
- YMLP

Usage
-----

[](#usage)

```
composer require rezozero/subscribeme

```

```
use SubscribeMe\Factory;

/**
* This library uses PSR18 and PSR17 so you need to provide a client that implements PSR18 like Guzzle for example
 * @param ClientInterface $client
 * @param RequestFactoryInterface $requestFactory
 * @param StreamFactoryInterface $streamFactory
*/
$factory = new Factory($client, $requestFactory, $streamFactory);

// ######## GUZZLE EXAMPLE ##########
$client = new \GuzzleHttp\Client();
$httpFactory = new GuzzleHttp\Psr7\HttpFactory();
$factory = new Factory($client, $httpFactory, $httpFactory);
// ##################################

// 'mailjet' | 'brevo' | 'mailchimp' | 'ymlp'
$subscriber = $factory->createFor('mailjet');

$subscriber->setApiKey('xxxx');
$subscriber->setApiSecret('xxxx');
$subscriber->setContactListId('xxxx');

$userConsent = new \SubscribeMe\GDPR\UserConsent();
$userConsent->setReferrerUrl('https://form.test');
$userConsent->setReferrerFieldName('gdpr_consent_referrer');
$userConsent->setConsentGiven(true);
$userConsent->setConsentFieldName('gdpr_consent');
$userConsent->setIpAddress('xx.xx.xx.xx');
$userConsent->setIpAddressFieldName('gdpr_consent_ip_address');
$userConsent->setConsentDate(new \DateTime());
$userConsent->setDateFieldName('gdpr_consent_date');
$userConsent->setUsage('E-mail marketing campaigns');
$userConsent->setUsageFieldName('gdpr_consent_usage');

$subscriber->subscribe('hello@super.test', ['Name' => 'John Doe'], [$userConsent]);

/**
 * Method for sending transactional emails (YMLP does not support transactional emails).
 *
 * @param array $emails (email required, name optional)
 * @param int|string $emailTemplateId required
 * @param array $variables optional
 */
$subscriber->sendTransactionalEmail($emails, $emailTemplateId, $variables)
```

### Symfony usage

[](#symfony-usage)

With Symfony, you don't have to use the `Factory`, you can directly make your code generic by depending on `SubscriberInterface`, which means that if you want to change platform later, you will just have to change the registration.

```
final class YourClass
{
    public function __construct(
        // Make it generic, let Symfony provide the right service for you
        private SubscriberInterface $subscriber
    ) {
    }

    public function sendTransactional()
    {
        $this->subscriber->sendTransactionalEmail(
            [
                new EmailAddress('user@example.com')
            ],
            $templateId
        )
    }
}
```

```
# services.yaml
services:
  SubscribeMe\Subscriber\SubscriberInterface:
    # Here register the platform class used in your project (example with Mailjet)
    class: SubscribeMe\Subscriber\MailjetSubscriber
    # Here comes the Symfony magic, PSR17 and PSR18 will be automatically provided
    autowire: true
    calls:
      # Here call necessary methods according to your platform (Mailjet need apiKey and apiSecret)
      - setApiKey: [ '%env(string:APP_MAILJET_API_KEY)%' ]
      - setApiSecret: [ '%env(string:APP_MAILJET_API_SECRET_KEY)%' ]
```

GDPR consent support
--------------------

[](#gdpr-consent-support)

Prepare your audience list with additional fields in order to store your users consent () :

```
$userConsent = new \SubscribeMe\GDPR\UserConsent();

$userConsent->setReferrerUrl('https://form.test');
$userConsent->setReferrerFieldName('gdpr_consent_referrer');

$userConsent->setConsentGiven(true);
$userConsent->setConsentFieldName('gdpr_consent');

$userConsent->setIpAddress('xx.xx.xx.xx');
$userConsent->setIpAddressFieldName('gdpr_consent_ip_address');

$userConsent->setConsentDate(new \DateTime());
$userConsent->setDateFieldName('gdpr_consent_date');

$userConsent->setUsage('E-mail marketing campaigns');
$userConsent->setUsageFieldName('gdpr_consent_usage');
```

Some platform already have special mechanism for GDPR consent such as *Mailchimp* :

```
$userConsent = new \SubscribeMe\GDPR\UserConsent();

$userConsent->setConsentGiven(true);
// Find your Mailchimp marketing permission ID
// with a single API call on some existing contacts
$userConsent->setConsentFieldName('e7443e1720');

$userConsent->setIpAddress('xx.xx.xx.xx');
```

You can add multiple `UserConsent` objects when platform allows it.

```
$userConsentEmail = new \SubscribeMe\GDPR\UserConsent();
$userConsentEmail->setConsentGiven(true);
$userConsentEmail->setConsentFieldName('e7443e1720');
$userConsentEmail->setIpAddress('xx.xx.xx.xx');

$userConsentAds = new \SubscribeMe\GDPR\UserConsent();
$userConsentAds->setConsentGiven(false);
$userConsentAds->setConsentFieldName('other_marketing_id');
$userConsentAds->setIpAddress('xx.xx.xx.xx');

$subscriber = $factory->createFor('mailchimp');
$subscriber->subscribe(
    'hello@super.test',
    ['FNAME'=>'Hello', 'LNAME'=>'Super'],
    [$userConsentEmail, $userConsentAds]
);
```

Mailchimp
---------

[](#mailchimp)

### Mailchimp options subscriber

[](#mailchimp-options-subscriber)

```
$subscriber = $factory->createFor('mailchimp');
$subscriber->setApiKey('your_api_key');
$subscriber->setContactListId('xxxx');
// Set you account datacenter
$subscriber->setDc('us19');
// Choose which status your new user will be given
$subscriber->setSubscribed();
// or
$subscriber->setPending();
```

### Mailchimp options sender transactional email

[](#mailchimp-options-sender-transactional-email)

Mailchimp use Mandrill api for his transactional emails See

```
$subscriber = $factory->createFor('mailchimp');
// Mailchimp only requires an API Key
$subscriber->setApiKey('mailchimp_api_key');
// use an array of value object EmailAddress for recipients
$emails = [
    new \SubscribeMe\ValueObject\EmailAddress('hello@super.test', 'John Doe')
];
// Mailchimp only use string for his $templateEmailId
$emailTemplateId = 'template_name';
/**
 * MailChimp accepts an array of variables to inject into your transactional template.
*/
$variables = [
    'FNAME' => 'John',
    'LNAME' => 'Doe'
];
$subscriber->sendTransactionalEmail($emails, $emailTemplateId, $variables);
```

### Mailchimp options unsubscribing

[](#mailchimp-options-unsubscribing)

Mailchimp does not support unsubscribing a user from a list with their email address, we throw an `UnsupportedUnsubscribePlatformException`.

YMLP
----

[](#ymlp)

### YMLP options subscriber

[](#ymlp-options-subscriber)

See [https://www.ymlp.com/app/api\_command.php?command=Contacts.Add](https://www.ymlp.com/app/api_command.php?command=Contacts.Add)

```
$subscriber = $factory->createFor('ymlp');
$subscriber->setApiKey('your_username');
$subscriber->setApiSecret('your_api_key');
$subscriber->setContactListId('your_group_id');
// if true the email address will be added even if this person previously
// unsubscribed or if the email address previously was removed by bounce back handling
$subscriber->setOverruleUnsubscribedBounced(true);
```

For getting your additional fields ID: see [https://www.ymlp.com/api/Fields.GetList?Key=api\_key&amp;Username=username](https://www.ymlp.com/api/Fields.GetList?Key=api_key&Username=username)

### YMLP options sender transactional email

[](#ymlp-options-sender-transactional-email)

YMLP does not support transactional email, we throw an `UnsupportedTransactionalEmailPlatformException`.

### YMLP options unsubscribing

[](#ymlp-options-unsubscribing)

YMLP does not support unsubscribing a user from a list with their email address, we throw an `UnsupportedUnsubscribePlatformException`.

Brevo
-----

[](#brevo)

### Brevo subscriber options

[](#brevo-subscriber-options)

See

```
$subscriber = $factory->createFor('brevo');
// Brevo only requires an API Key
$subscriber->setApiKey('brevo_api_key');
// Brevo list identifiers are int. You can subscribe user to multiple lists with comma-separated list
$subscriber->setContactListId('3,5,3');

$subscriber->subscribe('hello@super.test', ["FNAME" => "Elly", "LNAME" => "Roger"], [$userConsent]);
```

For getting your additional fields ID: see

### Brevo Double Opt-In options

[](#brevo-double-opt-in-options)

See

```
$subscriber = $factory->createFor('brevo-doi');
// Brevo only requires an API Key
$subscriber->setApiKey('brevo_api_key');
// Brevo list identifiers are int. You can subscribe user to multiple lists with comma-separated list
$subscriber->setContactListId('3,5,3');
$subscriber->setTemplateId(1);
$subscriber->setRedirectionUrl('https://www.example.com/subscribed');

$subscriber->subscribe('hello@super.test', ["FNAME" => "Elly", "LNAME" => "Roger"], [$userConsent]);
```

### Brevo sender transactional email options

[](#brevo-sender-transactional-email-options)

See

```
$subscriber = $factory->createFor('brevo');
// Brevo only requires an API Key
$subscriber->setApiKey('brevo_api_key');
// use an array of value object EmailAddress for recipients
$emails = [
    new EmailAddress('jimmy98@example.com', 'Jimmy');
]
// Brevo only use int for his $templateEmailId
$templateEmail = 1;
/**
 * Brevo accepts an array of variables to inject into your transactional template.
*/
$variables = [
    'FNAME' => 'Joe',
    'LNAME' => 'Doe'
];
$subscriber->sendTransactionalEmail($emails, $templateEmail, $variables);
```

### Brevo options unsubscribing

[](#brevo-options-unsubscribing)

See

```
$subscriber = $factory->createFor('brevo');
// Brevo only requires an API Key
$subscriber->setApiKey('brevo_api_key');
// Use Just One list Id in same time for remove contact from a list
$subscriber->setContactListId('3');
$subscriber->unsubscribe('jimmy98@example.com');
```

Mailjet
-------

[](#mailjet)

### Mailjet subscriber options

[](#mailjet-subscriber-options)

```
$subscriber = $factory->createFor('mailjet');
// Mailjet requires an API Key and an API Secret
$subscriber->setApiKey('mailjet_api_key');
$subscriber->setApiSecret('mailjet_api_secret')
// Mailjet list identifiers are int. You can subscribe user to multiple lists with comma-separated list
$subscriber->setContactListId('3,5,3');

$subscriber->subscribe('hello@super.test', ["FNAME" => "Elly", "LNAME" => "Roger"], [$userConsent]);
```

### Mailjet sender transactional email options

[](#mailjet-sender-transactional-email-options)

See

```
$subscriber = $factory->createFor('mailjet');
// Mailjet requires an API Key and an API Secret
$subscriber->setApiKey('mailjet_api_key');
$subscriber->setApiSecret('mailjet_api_secret')
// use an array of value object EmailAddress for recipients
$emails[] = new EmailAddress('passenger1@mailjet.com', 'passenger 1');
// Mailjet only use int for his $templateEmailId
$templateEmail = 1;
/**
 * Mailjet accepts an array of variables to inject into your transactional template.
*/
$variables = [
    'day' => 'Tuesday',
    'personalmessage' => 'Happy birthday!'
];
$subscriber->sendTransactionalEmail($emails, $templateEmail, $variables);
```

### MailJet options unsubscribing

[](#mailjet-options-unsubscribing)

MailJet does not support unsubscribing a user from a list with their email address, we throw an `UnsupportedUnsubscribePlatformException`.

OxiMailing
----------

[](#oximailing)

### OxiMailing subscriber options

[](#oximailing-subscriber-options)

```
$subscriber = $factory->createFor('oximailing');
// OxiMailing requires an API Key and an API Secret
$subscriber->setApiKey('oximailing_api_key');
$subscriber->setApiSecret('oximailing_api_secret')
// OxiMailing list identifiers are int. You can only subscribe user to one list
$subscriber->setContactListId('123');
// OxiMailing Accept 3 modes
//Allows you to explain what to do with new duplicates :
//- ignore : remove duplicates
//- insert : don't do anything (all contacts are imported even duplicates)
//- update : update existing contacts information rather than adding duplicates
// Defaults to mode: ignore
$subscriber->subscribe('hello@super.test');
// You can override subscription mode using options array
$subscriber->subscribe('hello@super.test', ['mode' => 'update']);
```

### OxiMailing sender transactional email options

[](#oximailing-sender-transactional-email-options)

OxiMailing does not support transactional email, we throw an `UnsupportedTransactionalEmailPlatformException`.

### OxiMailing options unsubscribing

[](#oximailing-options-unsubscribing)

See [https://api.oximailing.com/doc/#/contacts/delete\_lists\_\_ListId\_\_contacts](https://api.oximailing.com/doc/#/contacts/delete_lists__ListId__contacts)

```
$subscriber = $factory->createFor('oximailing');
// OxiMailing requires an API Key and an API Secret
$subscriber->setApiKey('oximailing_api_key');
$subscriber->setApiSecret('oximailing_api_secret')
// You can only unsubscribe one user to one list
$subscriber->setContactListId('123');
$subscriber->unsubscribe('jimmy98@example.com');
```

###  Health Score

55

—

FairBetter than 97% of packages

Maintenance95

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 73.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 ~186 days

Recently: every ~154 days

Total

15

Last Release

23d ago

Major Versions

0.1.5 → 1.0.02020-09-21

1.2.0 → 2.0.02024-09-30

PHP version history (3 changes)0.1.0PHP &gt;=7.1

1.1.0PHP &gt;=7.4

2.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/380026?v=4)[Ambroise Maupate](/maintainers/ambroisemaupate)[@ambroisemaupate](https://github.com/ambroisemaupate)

---

Top Contributors

[![ambroisemaupate](https://avatars.githubusercontent.com/u/380026?v=4)](https://github.com/ambroisemaupate "ambroisemaupate (22 commits)")[![eliot488995568](https://avatars.githubusercontent.com/u/72140926?v=4)](https://github.com/eliot488995568 "eliot488995568 (8 commits)")

---

Tags

emailmailing-listmailjet-api

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/rezozero-subscribeme/health.svg)

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

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[cakephp/cakephp

The CakePHP framework

8.9k19.5M1.8k](/packages/cakephp-cakephp)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6942.5M421](/packages/drupal-core-recommended)[mollie/mollie-api-php

Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.

60216.0M83](/packages/mollie-mollie-api-php)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)

PHPackages © 2026

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