PHPackages                             axleus/axleus-mailer - 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. axleus/axleus-mailer

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

axleus/axleus-mailer
====================

Php Mail abstraction for a variety of php mailer libraries for mezzio applications

0.0.x-dev(1y ago)01.6k[1 issues](https://github.com/axleus/axleus-mailer/issues)[2 PRs](https://github.com/axleus/axleus-mailer/pulls)2BSD-3-ClausePHPPHP ~8.1.0 || ~8.2.0 || ~8.3.0CI failing

Since Nov 17Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/axleus/axleus-mailer)[ Packagist](https://packagist.org/packages/axleus/axleus-mailer)[ Docs](https://github.com/orgs/axleus/discussions)[ RSS](/packages/axleus-axleus-mailer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (14)Versions (11)Used By (2)

axleus/axleus-mailer
====================

[](#axleusaxleus-mailer)

A PHP email abstraction library for [Laminas Mezzio](https://docs.mezzio.dev/) applications. It decouples application code from any specific mail transport library through an adapter pattern, allowing the underlying mailer to be swapped via configuration without touching application code.

> **Note:** This library is currently undergoing a refactor. Full documentation will follow once the refactor is complete.

Features
--------

[](#features)

- Adapter-based architecture — ship with a `PHPMailer` adapter; add others without changing application code
- PSR-15 middleware that pre-configures the mailer and injects it as a request attribute
- Laminas delegator (`MailerAwareDelegator`) for zero-config injection into any `MailerAwareInterface` service
- Optional command bus integration via `webware/command-bus`
- Optional event support via `webware/commandbus-event`
- Full Laminas Service Manager wiring through a `ConfigProvider`

Requirements
------------

[](#requirements)

- PHP 8.2 or later
- Laminas Mezzio application

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

[](#installation)

```
composer require axleus/axleus-mailer
```

If your application uses `laminas/laminas-component-installer`, the `ConfigProvider` will be registered automatically. Otherwise, add it manually to your configuration aggregator:

```
new Axleus\Mailer\ConfigProvider(),
```

Basic Configuration
-------------------

[](#basic-configuration)

Override the default adapter settings in your application config:

```
use Axleus\Mailer\ConfigProvider;
use Axleus\Mailer\Adapter\AdapterInterface;

return [
    ConfigProvider::class => [
        AdapterInterface::class => [
            'host'      => 'smtp.example.com',
            'smtp_auth' => true,
            'port'      => 587,
            'username'  => 'user@example.com',
            'password'  => 'secret',
            'from'      => 'no-reply@example.com',
        ],
    ],
];
```

Basic Usage
-----------

[](#basic-usage)

### Via PSR-15 Middleware

[](#via-psr-15-middleware)

Add `MailerMiddleware` to your pipeline. Downstream handlers can then retrieve the mailer from the request:

```
use Axleus\Mailer\MailerInterface;

$mailer = $request->getAttribute(MailerInterface::class);
```

### Via MailerAwareInterface

[](#via-mailerawareinterface)

Implement `MailerAwareInterface` on any service and add the `MailerAwareInterfaceTrait`. Register `MailerAwareDelegator` as a delegator for that service in your container config — the mailer will be injected automatically at resolution time.

### Via Command Bus (optional)

[](#via-command-bus-optional)

Inject `CommandBusInterface` and call `handle()` with a `SendEmailCommand`:

```
use Axleus\Mailer\CommandBus\SendEmailCommand;
use Webware\CommandBus\CommandBusInterface;

class MyRequestHandler
{
    public function __construct(
        private CommandBusInterface $commandBus
    ) {}

    public function handle(ServerRequestInterface $request): ResponseInterface
    {
        $result = $this->commandBus->handle(new SendEmailCommand(
            to: 'recipient@example.com',
            subject: 'Hello',
            body: 'Hello, world!',
        ));

        // $result is a CommandResultInterface (Success or Failure)
    }
}
```

The `SendEmailCommandHandler` is mapped automatically via `ConfigProvider` and executed through the command bus middleware pipeline.

License
-------

[](#license)

BSD-3-Clause. See [LICENSE](LICENSE) for details.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance68

Regular maintenance activity

Popularity21

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

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

Total

2

Last Release

71d ago

PHP version history (2 changes)0.0.x-devPHP ~8.1.0 || ~8.2.0 || ~8.3.0

0.2.x-devPHP ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/4d6eed33e61a99f1147789696252f4523130b5035a19eb07e034a7407fd44548?d=identicon)[tyrsson](/maintainers/tyrsson)

---

Top Contributors

[![tyrsson](https://avatars.githubusercontent.com/u/1237487?v=4)](https://github.com/tyrsson "tyrsson (32 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (4 commits)")

---

Tags

mezzioPHP mailaxleusMailerInterface abstraction for mezzio applications

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/axleus-axleus-mailer/health.svg)

```
[![Health](https://phpackages.com/badges/axleus-axleus-mailer/health.svg)](https://phpackages.com/packages/axleus-axleus-mailer)
```

###  Alternatives

[slm/mail

Integration of various email service providers in the Laminas\\Mail

108732.4k1](/packages/slm-mail)[nfephp-org/sped-mail

API para geração e envio dos emails relacionados com o SPED.

1123.7k](/packages/nfephp-org-sped-mail)

PHPackages © 2026

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