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(11mo ago)07MITPHP

Since Aug 6Pushed 11mo 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 today

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

26

—

LowBetter than 41% of packages

Maintenance52

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

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

331d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/76789892?v=4)[Aslam](/maintainers/aslamhus)[@aslamhus](https://github.com/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

[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M203](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.1k17.8k](/packages/prestashop-prestashop)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[blackfire/player

A powerful web crawler and web scraper with Blackfire support

49617.1k](/packages/blackfire-player)[sproutcms/cms

Enterprise content management and framework

242.5k4](/packages/sproutcms-cms)

PHPackages © 2026

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