PHPackages                             ebittleman/mailgun-zf2 - 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. [Framework](/categories/framework)
4. /
5. ebittleman/mailgun-zf2

ActiveLibrary[Framework](/categories/framework)

ebittleman/mailgun-zf2
======================

ZF2 Wrapper for Mailgun

1.0.4(10y ago)02.3k1[1 PRs](https://github.com/ebittleman/mailgun-zf2/pulls)The MIT License (MIT)PHPPHP &gt;=5.3.3

Since May 6Pushed 7y ago1 watchersCompare

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

READMEChangelogDependencies (3)Versions (8)Used By (0)

Mailgun ZF2 Module
==================

[](#mailgun-zf2-module)

[![Build Status](https://camo.githubusercontent.com/088bc0625b41462c96019435e7ada772de4df6405df33168268a1786103ac925/68747470733a2f2f7472617669732d63692e6f72672f65626974746c656d616e2f6d61696c67756e2d7a66322e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ebittleman/mailgun-zf2)[![Build Status](https://camo.githubusercontent.com/96afd9087573bde7ab0f7ada4225def15e8541c30a137ecd9303ae226690a19e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f65626974746c656d616e2f6d61696c67756e2d7a66322e737667)](https://packagist.org/packages/ebittleman/mailgun-zf2)

This is a super new library and no guarantees are made on anything. It pretty much just hooks [mailgun/mailgun-php](https://github.com/mailgun/mailgun-php)directly into Zend Framework 2 Have fun.

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

[](#installation)

```
composer require ebittleman/mailgun-zf2

```

Module Config
-------------

[](#module-config)

This module is pretty config light, just need to know your api key and domain for Mailgun. BEWARE: do not commit your creds unencrypted to public repos!!!!

```
return array(
    'mailgun' => array(
        'apiKey' => 'YOUR_MAILGUN_APIKEY',
        'domain' => 'YOUR_MAILGUN_DOMAIN',
    ),
);

```

Application Config
------------------

[](#application-config)

You will need to enable the module by adding it to your application config

```
return array(
    'modules' => array(
        ...YOUR MODULES...,
        'MailgunZf2'
    ),
    'module_listener_options' => array(
        'config_glob_paths' => array(
            ...YOUR CONFIG PATHS...
        ),
        'module_paths' => array(
            ...YOUR MODULES PATHS...
        )
    )
);

```

Super Basic Usage
-----------------

[](#super-basic-usage)

So the basic idea here is that the MessageViewModel is pretty much just an view adapter wrapped around `Mailgun\MessagesMessageBuilder` and it gets passed to a controller plugin that will prepare that message to be sent at ZF2's MvcEvent::EVENT\_FINSH event

```
namespace MailgunZf2\Controller;

use MailgunZf2\View\Model\MessageViewModel;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;

class IndexController extends AbstractActionController
{

    const HTMLTEMPLATE = 'emails/html.phtml';

    const TEXTTEMPLATE = 'emails/text.phtml';

    const FIRSTNAME = 'Chump';

    const SUBJECT = 'Welcome to spam town';

    public function indexAction()
    {
        $message = new MessageViewModel(
            static::HTMLTEMPLATE,
            static::TEXTTEMPLATE,
            array(
                'firstName' => 'Bob',
                'subject' => 'Howdy There Bob'
            )
        );

        $message->addToRecipient('someemail@example.com');
        $message->setFromAddress('fromsomeone@example.com');

        $this->mailgun($message);

        return new ViewModel();
    }
}

```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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 ~5 days

Total

7

Last Release

3997d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/23c1c857bf6c2f790d059deaa5b10f94c56847112e7434bd7fcf386ade729777?d=identicon)[ebittleman](/maintainers/ebittleman)

---

Top Contributors

[![ebittleman](https://avatars.githubusercontent.com/u/1635274?v=4)](https://github.com/ebittleman "ebittleman (12 commits)")

---

Tags

frameworkmailgunzf2

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ebittleman-mailgun-zf2/health.svg)

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

PHPackages © 2026

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