PHPackages                             twentytwo-labs/behat-fake-mailer-extension - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. twentytwo-labs/behat-fake-mailer-extension

ActiveLibrary[Testing &amp; Quality](/categories/testing)

twentytwo-labs/behat-fake-mailer-extension
==========================================

Behat contexts

1.0.0(1y ago)01612PHPPHP &gt;=8.1CI passing

Since Feb 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/TwentytwoLabs/behat-fake-mailer-extension)[ Packagist](https://packagist.org/packages/twentytwo-labs/behat-fake-mailer-extension)[ RSS](/packages/twentytwo-labs-behat-fake-mailer-extension/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (8)Versions (2)Used By (2)

Behat Fake Mailer Extension
===========================

[](#behat-fake-mailer-extension)

A simple PHP (8.1+) \[Behat\] extension for fake mailer like [Mailhog](https://github.com/mailhog/MailHog) or [Mailpit](https://github.com/axllent/mailpit) for example.

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

[](#installation)

This package require Symfony HTTP client implementation.

The clients that come with this extension can be found in the table below.

Client aliasHow to Installmailhugcomposer require twentytwo-labs/mailhog-fake-mailer-clientUsage
-----

[](#usage)

### Register extension in Behat

[](#register-extension-in-behat)

Add the extension to your `behat.yml` like so:

```
default:
  suites:
    # your suite configuration here
  extensions:
   TwentytwoLabs\BehatFakeMailerExtension:
      base_url: http://localhost:8025 # optional, defaults to 'http://localhost:8025'
      client: ''
```

The `base_url` is the URL where the Fake Mailer Web UI is listening to (by default this is `).

### Use FakeMailerContext

[](#use-fakemailercontext)

You must configure behat to use `TwentytwoLabs\BehatFakeMailerExtension\Context\FakeMailerContext`, so add this line in `behat.yaml`:

```
default:
  suites:
    contexts:
       - TwentytwoLabs\BehatFakeMailerExtension\Context\FakeMailerContext: ~
```

This enables the following Gherkin for your scenarios to make assumptions on received email messages:

```
Given my inbox is empty # purge all emails
Then I should see 1 email
Then I should see 1 email from "no-reply@example.org"
Then I should see 1 email to "john.doe@example.org"
Then I should see 1 email with subject "Contact"
Then I should see 1 email with body "Lorem Ipsum"
Then I should see 1 email from "no-reply@example.org" to "john.doe@example.org"
Then I should see 1 email from "no-reply@example.org" with subject "Contact"
Then I should see 1 email from "no-reply@example.org" with body "Lorem Ipsum"
Then I should see 1 email to "john.doe@example.org" with subject "Contact"
Then I should see 1 email to "john.doe@example.org" with body "Lorem Ipsum"
Then I should see 1 email with subject "Contact" and body "Lorem Ipsum"
Then I should see 1 email from "no-reply@example.org" to "john.doe@example.org" with subject "Contact"
Then I should see 1 email from "no-reply@example.org" to "john.doe@example.org" with body "Lorem Ipsum"
Then I should see 1 email from "no-reply@example.org" with subject "Contact" and body "Lorem Ipsum"
Then I should see 1 email to "john.doe@example.org" with subject "Contact" and body "Lorem Ipsum"
Then I should see 1 email from "no-reply@example.org" to "john.doe@example.org" with subject "Contact" and body Lorem Ipsum"
```

### Implement your own client

[](#implement-your-own-client)

1. First your need to create your client class which implement the `TwentytwoLabs\BehatFakeMailerExtension\Client\ClientInterface` interface
2. In your `behat.yaml` file:

```
default:
  suites:
    # your suite configuration here
  extensions:
   TwentytwoLabs\BehatFakeMailerExtension:
      base_url: http://localhost:8025 # optional, defaults to 'http://localhost:8025'
      client: ''
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance42

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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

459d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e755df79c9237f59677baef80e49defca9c8a7988c149e5024fa0ccc063c365?d=identicon)[ThibautAlgrin](/maintainers/ThibautAlgrin)

---

Tags

symfonyBehatFake Mailer

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/twentytwo-labs-behat-fake-mailer-extension/health.svg)

```
[![Health](https://phpackages.com/badges/twentytwo-labs-behat-fake-mailer-extension/health.svg)](https://phpackages.com/packages/twentytwo-labs-behat-fake-mailer-extension)
```

###  Alternatives

[drupal/drupal-extension

Drupal extension for Behat

22215.1M147](/packages/drupal-drupal-extension)[robertfausk/behat-panther-extension

Symfony Panther extension for Behat

341.7M87](/packages/robertfausk-behat-panther-extension)[imbo/behat-api-extension

API extension for Behat

1082.5M9](/packages/imbo-behat-api-extension)[novaway/common-contexts

Novaway Behat common contexts

18187.8k3](/packages/novaway-common-contexts)[macpaw/behat-messenger-context

Behat Context for testing Symfony Messenger component

16232.9k](/packages/macpaw-behat-messenger-context)

PHPackages © 2026

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