PHPackages                             fluchi/mailgun-handler - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. fluchi/mailgun-handler

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

fluchi/mailgun-handler
======================

Mailgun handler for Monolog

1.0.0(6y ago)045MITPHPPHP ^7.1.3CI failing

Since Jun 25Pushed 6y agoCompare

[ Source](https://github.com/fluchi/mailgun-handler)[ Packagist](https://packagist.org/packages/fluchi/mailgun-handler)[ RSS](/packages/fluchi-mailgun-handler/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (7)Versions (2)Used By (0)

Mailgun handler
===============

[](#mailgun-handler)

Mailgun handler is a [Monolog](https://github.com/Seldaek/monolog) handler that email log entries using [Mailgun API](https://github.com/mailgun/mailgun-php).

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

[](#installation)

### Requirements

[](#requirements)

Mailgun handler requires [PHP](https://php.net/) 7.1.3 or higher, [Monolog](https://github.com/Seldaek/monolog) 1.X or higher and [Mailgun API](https://github.com/mailgun/mailgun-php) 2.8 or higher.

### Using composer

[](#using-composer)

The easiest way to install Mailgun handler is via [composer](https://getcomposer.org/) typing the following command:

```
$ composer require fluchi/mailgun-handler
```

### Configuration

[](#configuration)

On your project's root, create a file called *.env*, if there is any, and added the following content:

```
# /.env
MAILGUN_API_KEY="your mailgun API key"
MAILGUN_DOMAIN="your mailgun domain"
MAILGUN_FROM="default from"
MAILGUN_TO="default to"

```

*MAILGUN\_FROM* and *MAILGUN\_TO* are optional.

Default level to email is Logger::WARNING. You can change as shown below.

Usage
-----

[](#usage)

After installation, Mailgun handler will be available over `MailgunHandler` namespace.

```
use Monolog\Logger;
use MailgunHandler\MailgunHandler;

require __DIR__ . '/vendor/autoload.php';

$logger = new Logger('foobar-channel');

// email based on .env config file
$logger->pushHandler(new MailgunHandler('email subject'));

// email WARNING level
$logger->pushHandler(new MailgunHandler('email subject', null, null, Logger::WARNING));

// you can change from and to on parameters 2 and 3, respectivelly
$logger->pushHandler(new MailgunHandler('email subject', 'foo@example.com', 'bar@example.com'));
```

License
-------

[](#license)

This library is licensed under the MIT license. See the [LICENSE](https://github.com/fluchi/mailgun-handler/blob/master/LICENSE) file for details.

Chagelog
--------

[](#chagelog)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

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

2516d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/487406e08efb2b5dfd5ff64d40274ad19940d5d1af6f1bb946f92c59d220678b?d=identicon)[fluchi](/maintainers/fluchi)

---

Tags

handlermailgunmonolog

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fluchi-mailgun-handler/health.svg)

```
[![Health](https://phpackages.com/badges/fluchi-mailgun-handler/health.svg)](https://phpackages.com/packages/fluchi-mailgun-handler)
```

###  Alternatives

[logtail/monolog-logtail

Logtail handler for Monolog

233.2M3](/packages/logtail-monolog-logtail)[macpaw/sentry-monolog-adapter

Sentry monolog logging bundle

25232.9k](/packages/macpaw-sentry-monolog-adapter)

PHPackages © 2026

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