PHPackages                             aslamhus/mailgun-email-wrapper - 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. aslamhus/mailgun-email-wrapper

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

aslamhus/mailgun-email-wrapper
==============================

a fluent interface for sending Mailgun emails

v1.0.1(9mo ago)07MITPHP

Since Aug 6Pushed 9mo agoCompare

[ Source](https://github.com/aslamhus/aslamhus-mailgun-email-wrapper)[ Packagist](https://packagist.org/packages/aslamhus/mailgun-email-wrapper)[ RSS](/packages/aslamhus-mailgun-email-wrapper/feed)WikiDiscussions main Synced 1mo ago

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

Aslamhus\\Email PHP Class
=========================

[](#aslamhusemail-php-class)

Overview
--------

[](#overview)

A PHP package to simplify the Mailgun PHP API and make its methods conform to Sengrid API.

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

[](#installation)

```
composer require aslamhus/mailgun-email-wrapper
```

Usage
-----

[](#usage)

### Send basic email

[](#send-basic-email)

```
$email = new Email('your-sendgrid-api-key')
    ->setFrom('sender@example.com', 'Sender Name')
    ->addTo('recipient@example.com', 'Recipient Name')
    ->setSubject('Test email')
    ->addContent('text/plain', 'Hello world!')
    ->send();
```

### Send Email with dynamic template data

[](#send-email-with-dynamic-template-data)

Dynamic template data variables can be set using `handlebars` {{my\_var}}. For more info see

```
$email = new Email('your-sendgrid-api-key')
    ->setFrom('sender@example.com', 'Sender Name')
    ->addTo('recipient@example.com', 'Recipient Name')
    ->setSubject('Test email')
    ->setTemplateId('your-template-id')
    ->addDynamicTemplateDatas([
        'subject' => 'My dynamic template email'
        'name' => '2020-01-01',
        'link' => 'https://www.example.com',
    ])
    ->send();
```

### Additional Features

[](#additional-features)

- **Add Attachments:**

    ```
    $email->addAttachment('path/to/file.pdf', 'application/pdf', 'document.pdf');
    ```
- **Add Content:**

    ```
    $email->addContent('text/plain', 'This is the plain text content');
    $email->addContent('text/html', 'This is the HTML content');
    ```
- **Get email response:**

    ```
    // retrieve the response body, headers and status code after sending
    $response = $email->getResponse();
    ```

Testing
-------

[](#testing)

To run tests on this library, follow these steps:

1. Set your sample.env file with the require fields, then rename sample.env to .env
2. Run tests

```
composer run test
```

License
-------

[](#license)

This class is open-source and released under the [MIT License](LICENSE). Feel free to use, modify, and distribute it according to your project's needs.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance61

Regular maintenance activity

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

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

Total

2

Last Release

276d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cf398f3954c2155216c23f9573a1729d46cbe95f9fdf17fc3da7d0da55fe1903?d=identicon)[aslamhus](/maintainers/aslamhus)

---

Top Contributors

[![aslamhus](https://avatars.githubusercontent.com/u/76789892?v=4)](https://github.com/aslamhus "aslamhus (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aslamhus-mailgun-email-wrapper/health.svg)

```
[![Health](https://phpackages.com/badges/aslamhus-mailgun-email-wrapper/health.svg)](https://phpackages.com/packages/aslamhus-mailgun-email-wrapper)
```

###  Alternatives

[mailersend/laravel-driver

MailerSend Laravel Driver

87732.8k4](/packages/mailersend-laravel-driver)[dotdigital/dotdigital-magento2-extension

Dotdigital for Magento 2

50374.2k18](/packages/dotdigital-dotdigital-magento2-extension)

PHPackages © 2026

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