PHPackages                             lartisan/laravel-mailgun-client - 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. lartisan/laravel-mailgun-client

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

lartisan/laravel-mailgun-client
===============================

A clean Laravel HTTP client for the Mailgun API, with mailing list management and newsletter sending support.

1.1.0(2mo ago)17↓90%MITPHPPHP ^8.2CI passing

Since Mar 26Pushed 2mo agoCompare

[ Source](https://github.com/lartisan/laravel-mailgun-client)[ Packagist](https://packagist.org/packages/lartisan/laravel-mailgun-client)[ RSS](/packages/lartisan-laravel-mailgun-client/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (2)Dependencies (20)Versions (3)Used By (0)

Laravel Mailgun Client
======================

[](#laravel-mailgun-client)

[![Downloads](https://camo.githubusercontent.com/cd0edac73ed9897a857ad309fd46a434ecd6b904d5974c76a0677250c7877512/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c6172746973616e2f6c61726176656c2d6d61696c67756e2d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lartisan/laravel-mailgun-client/stats)[![Tests](https://camo.githubusercontent.com/9041ec2b99440d71c03d5caa1ab5b4da580ecbccc96ccee66b4bd5e02e167c74/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c6172746973616e2f6c61726176656c2d6d61696c67756e2d636c69656e742f74657374732e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265266c6162656c3d7465737473)](https://github.com/lartisan/laravel-mailgun-client/actions)[![Latest Version on Packagist](https://camo.githubusercontent.com/4c0eb933221a41848aa9a877ffb4efa3973794363cdc398c5971b32ee27ebcba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6172746973616e2f6c61726176656c2d6d61696c67756e2d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lartisan/laravel-mailgun-client)[![License](https://camo.githubusercontent.com/1caaf91fd3adc5010398c0aa6a6f1f06c770c5a84e34670bee8fa270127d0548/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c6172746973616e2f6c61726176656c2d6d61696c67756e2d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://github.com/lartisan/laravel-mailgun-client/blob/main/LICENSE)

A clean Laravel HTTP client for the Mailgun API with mailing list management and newsletter sending support.

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

[](#installation)

```
composer require lartisan/laravel-mailgun-client
```

The package auto-discovers its service provider and the `Mailgun` facade.

Configuration
-------------

[](#configuration)

Publish the config file:

```
php artisan vendor:publish --tag=mailgun-config
```

Add the following to your `.env` file:

```
MAILGUN_DOMAIN=your-domain.com
MAILGUN_SECRET=key-xxxxxxxxxxxxxxxxxxxxxxxxxxxx
MAILGUN_API_KEY=key-xxxxxxxxxxxxxxxxxxxxxxxxxxxx
MAILGUN_SENDING_API_KEY=key-xxxxxxxxxxxxxxxxxxxxxxxxxxxx
MAILGUN_ENDPOINT=https://api.mailgun.net
MAILGUN_SUBSCRIBERS_LIST=newsletter@your-domain.com
```

> Use `https://api.eu.mailgun.net` as the endpoint if your domain is registered in the EU region.

Usage
-----

[](#usage)

### Via Facade

[](#via-facade)

```
use Lartisan\MailgunClient\Facades\Mailgun;

// Send a custom email
Mailgun::send([
    'to'      => 'recipient@example.com',
    'subject' => 'Hello!',
    'html'    => 'Hello, world!',
]);

// Send a newsletter (uses the configured subscribers_list as the default "to")
Mailgun::sendNewsletter('recipient@example.com', 'My Newsletter', 'Content');

// Fetch all mailing lists
$lists = Mailgun::fetchMailingLists();

// Add a member to a mailing list (unsubscribed)
Mailgun::addMemberToMailingList('user@example.com', 'list@your-domain.com');

// Subscribe a member
Mailgun::subscribeMemberToMailingList('user@example.com', 'list@your-domain.com');

// Unsubscribe a member
Mailgun::unsubscribeMemberFromMailingList('user@example.com', 'list@your-domain.com');

// Get all registered webhooks
$webhooks = Mailgun::getAllWebhooks();
```

### Via Dependency Injection

[](#via-dependency-injection)

```
use Lartisan\MailgunClient\Mailgun;

class NewsletterService
{
    public function __construct(
        protected Mailgun $mailgun,
    ) {}

    public function send(string $email, string $subject, string $html): void
    {
        $this->mailgun->sendNewsletter($email, $subject, $html);
    }
}
```

Value Objects
-------------

[](#value-objects)

Mailing list data is returned as `Lartisan\MailgunClient\ValueObjects\MailingList` instances:

```
$lists = Mailgun::fetchMailingLists();

foreach ($lists as $list) {
    echo $list->name;           // The list display name
    echo $list->address;        // The list email address
    echo $list->members_count;  // Total member count
    echo $list->access_level;   // readonly, members, everyone
}
```

Testing
-------

[](#testing)

```
use Lartisan\MailgunClient\Facades\Mailgun;

it('sends a newsletter', function () {
    Mailgun::shouldReceive('sendNewsletter')
        ->once()
        ->with('user@example.com', 'Subject', 'Content');

    // call your code...
});
```

License
-------

[](#license)

The MIT License (MIT). See [LICENSE](LICENSE) for details.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance85

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

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

Total

2

Last Release

84d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2dcd7882a854e97effa9fbf7c979e9c9c7f9795bfb5422224a22253a10fd0cc0?d=identicon)[cristake](/maintainers/cristake)

---

Top Contributors

[![lartisan](https://avatars.githubusercontent.com/u/7920412?v=4)](https://github.com/lartisan "lartisan (6 commits)")

---

Tags

laravelemailmailgunmailing listnewsletter

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/lartisan-laravel-mailgun-client/health.svg)

```
[![Health](https://phpackages.com/badges/lartisan-laravel-mailgun-client/health.svg)](https://phpackages.com/packages/lartisan-laravel-mailgun-client)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k28.4M137](/packages/laravel-cashier)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k14.1M122](/packages/laravel-pulse)[propaganistas/laravel-disposable-email

Disposable email validator

6012.9M7](/packages/propaganistas-laravel-disposable-email)

PHPackages © 2026

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