PHPackages                             pomeloproductions/laravel-newsletter - 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. pomeloproductions/laravel-newsletter

ActiveLibrary

pomeloproductions/laravel-newsletter
====================================

Manage newsletters in Laravel

1.0.0(5y ago)012MITPHPPHP ^7.3

Since Oct 1Pushed 5y agoCompare

[ Source](https://github.com/PomeloProductions/laravel-newsletter)[ Packagist](https://packagist.org/packages/pomeloproductions/laravel-newsletter)[ Docs](https://github.com/pomeloproductions/laravel-newsletter)[ RSS](/packages/pomeloproductions-laravel-newsletter/feed)WikiDiscussions master Synced 2d ago

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

Manage newsletters in Laravel
=============================

[](#manage-newsletters-in-laravel)

[![Latest Version](https://camo.githubusercontent.com/81012f310481681553b6c8d216352780d3f3f6deb58d3728dd7d57edcf0ab487/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f7370617469652f6c61726176656c2d6e6577736c65747465722e7376673f7374796c653d666c61742d737175617265)](https://github.com/spatie/laravel-newsletter/releases)[![MIT Licensed](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![GitHub Workflow Status](https://camo.githubusercontent.com/40419e00e3698027e76b6cf94530d6dab876ba747aa1627a140569588b958816/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7370617469652f6c61726176656c2d6e6577736c65747465722f72756e2d74657374733f6c6162656c3d7465737473)](https://camo.githubusercontent.com/40419e00e3698027e76b6cf94530d6dab876ba747aa1627a140569588b958816/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7370617469652f6c61726176656c2d6e6577736c65747465722f72756e2d74657374733f6c6162656c3d7465737473)[![Check & fix styling](https://github.com/spatie/laravel-newsletter/workflows/Check%20&%20fix%20styling/badge.svg)](https://github.com/spatie/laravel-newsletter/workflows/Check%20&%20fix%20styling/badge.svg)[![Total Downloads](https://camo.githubusercontent.com/8151b7c363aa96d092fa0494295f966145d3dc6bd0c8d8ab50e7a048259ef944/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f6c61726176656c2d6e6577736c65747465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-newsletter)

This package provides an easy way to integrate MailChimp with Laravel.

Should you find that Mailchimp is too expensive for your use case, consider using [Mailcoach](https://mailcoach.app) instead. Mailcoach is a premium Laravel package that allows you to self host your email lists and campaigns.

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

[](#installation)

You can install this package via composer using:

```
composer require pomeloproductions/laravel-newsletter
```

The package will automatically register itself.

To publish the config file to `config/newsletter.php` run:

```
php artisan vendor:publish --provider="PomeloProductions\Newsletter\NewsletterServiceProvider"
```

This will publish a file `newsletter.php` in your config directory with the following contents:

```
return [

    /*
     * The driver to use to interact with MailChimp API.
     * You may use "log" or "null" to prevent calling the
     * API directly from your environment.
     */
    'driver' => env('MAILCHIMP_DRIVER', 'api'),

    /*
     * The API key of a MailChimp account. You can find yours at
     * https://us10.admin.mailchimp.com/account/api-key-popup/.
     */
    'apiKey' => env('MAILCHIMP_APIKEY'),

    /*
     * The listName to use when no listName has been specified in a method.
     */
    'defaultListName' => 'subscribers',

    /*
     * Here you can define properties of the lists.
     */
    'lists' => [

        /*
         * This key is used to identify this list. It can be used
         * as the listName parameter provided in the various methods.
         *
         * You can set it to any string you want and you can add
         * as many lists as you want.
         */
        'subscribers' => [

            /*
             * A MailChimp list id. Check the MailChimp docs if you don't know
             * how to get this value:
             * http://kb.mailchimp.com/lists/managing-subscribers/find-your-list-id.
             */
            'id' => env('MAILCHIMP_LIST_ID'),
        ],
    ],

    /*
     * If you're having trouble with https connections, set this to false.
     */
    'ssl' => true,
];
```

Usage
-----

[](#usage)

Behind the scenes v3 for the MailChimp API is used.

After you've installed the package and filled in the values in the config-file working with this package will be a breeze. All the following examples use the facade. Don't forget to import it at the top of your file.

```
use Newsletter;
```

### Subscribing, updating and unsubscribing

[](#subscribing-updating-and-unsubscribing)

Subscribing an email address can be done like this:

```
use Newsletter;

Newsletter::subscribe('rincewind@discworld.com');
```

Let's unsubscribe someone:

```
Newsletter::unsubscribe('the.luggage@discworld.com');
```

You can pass some merge variables as the second argument:

```
Newsletter::subscribe('rincewind@discworld.com', ['FNAME'=>'Rince', 'LNAME'=>'Wind']);
```

> Please note the at the time of this writing the default merge variables in MailChimp are named `FNAME` and `LNAME`. In our examples we use `firstName` and `lastName` for extra readability.

You can subscribe someone to a specific list by using the third argument:

```
Newsletter::subscribe('rincewind@discworld.com', ['FNAME'=>'Rince', 'LNAME'=>'Wind'], 'subscribers');
```

That third argument is the name of a list you configured in the config file.

You can also subscribe and/or update someone. The person will be subscribed or updated if he/she is already subscribed:

```
Newsletter::subscribeOrUpdate('rincewind@discworld.com', ['FNAME'=>'Foo', 'LNAME'=>'Bar']);
```

You can subscribe someone to one or more specific group(s)/interest(s) by using the fourth argument:

```
Newsletter::subscribeOrUpdate('rincewind@dscworld.com', ['FNAME'=>'Rince','LNAME'=>'Wind'], 'subscribers', ['interests'=>['interestId'=>true, 'interestId'=>true]])
```

Simply add `false` if you want to remove someone from a group/interest.

You can also unsubscribe someone from a specific list:

```
Newsletter::unsubscribe('rincewind@discworld.com', 'subscribers');
```

### Deleting subscribers

[](#deleting-subscribers)

Deleting is not the same as unsubscribing. Unlike unsubscribing, deleting a member will result in the loss of all history (add/opt-in/edits) as well as removing them from the list. In most cases you want to use `unsubscribe` instead of `delete`.

Here's how to perform a delete:

```
Newsletter::delete('rincewind@discworld.com');
```

### Deleting subscribers permanently

[](#deleting-subscribers-permanently)

Delete all personally identifiable information related to a list member, and remove them from a list. This will make it impossible to re-import the list member.

Here's how to perform a permanent delete:

```
Newsletter::deletePermanently('rincewind@discworld.com');
```

### Getting subscriber info

[](#getting-subscriber-info)

You can get information on a subscriber by using the `getMember` function:

```
Newsletter::getMember('lord.vetinari@discworld.com');
```

This will return an array with information on the subscriber. If there's no one subscribed with that e-mail address the function will return `false`

There's also a convenience method to check if someone is already subscribed:

```
Newsletter::hasMember('nanny.ogg@discworld.com'); //returns a boolean
```

In addition to this you can also check if a user is subscribed to your list:

```
Newsletter::isSubscribed('lord.vetinari@discworld.com'); //returns a boolean
```

### Creating a campaign

[](#creating-a-campaign)

This the signature of `createCampaign`:

```
public function createCampaign(
    string $fromName,
    string $replyTo,
    string $subject,
    string $html = '',
    string $listName = '',
    array $options = [],
    array $contentOptions = [])
```

Note the campaign will only be created, no emails will be sent out.

### Handling errors

[](#handling-errors)

If something went wrong you can get the last error with:

```
Newsletter::getLastError();
```

If you just want to make sure if the last action succeeded you can use:

```
Newsletter::lastActionSucceeded(); //returns a boolean
```

### Need something else?

[](#need-something-else)

If you need more functionality you get an instance of the underlying [MailChimp Api](https://github.com/drewm/mailchimp-api) with:

```
$api = Newsletter::getApi();
```

Testing
-------

[](#testing)

Run the tests with:

```
vendor/bin/phpunit
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)be dedicated to allocating workforce on maintenance and new awesome stuff.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.8% 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

Unknown

Total

1

Last Release

2050d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/64adfef0c50eabe1b5a67f23b73d69994e1eb4b65d7a4160815de5c7991938bc?d=identicon)[bryce13950](/maintainers/bryce13950)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (143 commits)")[![rubenvanassche](https://avatars.githubusercontent.com/u/619804?v=4)](https://github.com/rubenvanassche "rubenvanassche (13 commits)")[![bryce13950](https://avatars.githubusercontent.com/u/6487928?v=4)](https://github.com/bryce13950 "bryce13950 (12 commits)")[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (9 commits)")[![lartisan](https://avatars.githubusercontent.com/u/7920412?v=4)](https://github.com/lartisan "lartisan (5 commits)")[![drbyte](https://avatars.githubusercontent.com/u/404472?v=4)](https://github.com/drbyte "drbyte (3 commits)")[![jasonmccreary](https://avatars.githubusercontent.com/u/161071?v=4)](https://github.com/jasonmccreary "jasonmccreary (3 commits)")[![akoepcke](https://avatars.githubusercontent.com/u/5311185?v=4)](https://github.com/akoepcke "akoepcke (2 commits)")[![arondeparon](https://avatars.githubusercontent.com/u/7697?v=4)](https://github.com/arondeparon "arondeparon (2 commits)")[![d-jimenez](https://avatars.githubusercontent.com/u/74740646?v=4)](https://github.com/d-jimenez "d-jimenez (2 commits)")[![filisko](https://avatars.githubusercontent.com/u/8798694?v=4)](https://github.com/filisko "filisko (1 commits)")[![floflock](https://avatars.githubusercontent.com/u/3831745?v=4)](https://github.com/floflock "floflock (1 commits)")[![EsTharian](https://avatars.githubusercontent.com/u/25347659?v=4)](https://github.com/EsTharian "EsTharian (1 commits)")[![fridzema](https://avatars.githubusercontent.com/u/8180660?v=4)](https://github.com/fridzema "fridzema (1 commits)")[![haakym](https://avatars.githubusercontent.com/u/832687?v=4)](https://github.com/haakym "haakym (1 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (1 commits)")[![jrean](https://avatars.githubusercontent.com/u/5646128?v=4)](https://github.com/jrean "jrean (1 commits)")[![juukie](https://avatars.githubusercontent.com/u/2678657?v=4)](https://github.com/juukie "juukie (1 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![carlos-ea](https://avatars.githubusercontent.com/u/5512089?v=4)](https://github.com/carlos-ea "carlos-ea (1 commits)")

---

Tags

laravelmailchimpnewsletter

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pomeloproductions-laravel-newsletter/health.svg)

```
[![Health](https://phpackages.com/badges/pomeloproductions-laravel-newsletter/health.svg)](https://phpackages.com/packages/pomeloproductions-laravel-newsletter)
```

###  Alternatives

[spatie/laravel-newsletter

Manage Mailcoach and MailChimp newsletters in Laravel

1.6k6.3M26](/packages/spatie-laravel-newsletter)[hugofirth/mailchimp

Wrapper on the Mailchimp class provided by Mailchimp - with support for Laravel 4. v2.0.0 supports Mailchimp API verion 2.0

96121.6k](/packages/hugofirth-mailchimp)[salamwaddah/laravel-mandrill-driver

Mandrill notification channel for Laravel 5, 6, 7, 8, 9, 10, 11, 12

1174.3k](/packages/salamwaddah-laravel-mandrill-driver)[casinelli/laravel-campaignmonitor

A Laravel 5 wrapper for Campaign Monitor

1444.7k](/packages/casinelli-laravel-campaignmonitor)

PHPackages © 2026

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