tomi0/mailhog-api-testing

Mailhog testing api.

Installs: 14 788

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/tomi0/mailhog-api-testing

4.0.3 2025-10-29 19:04 UTC

This package is not auto-updated.

Last update: 2025-10-29 19:34:19 UTC


README

Test that your emails are sent

Install

composer require tomi0/mailhog-api-testing

Usage

Use Mailhog testing trait in your test:

use Mailhog\MailhogTesting;

class ClassName {
    use MailhogTesting;
    ...
}

Set up environment:

$this->setUpMailhogEnviroment($host, $smtpPort, $webPort, $isHttps);

Available methods:

// Check if message exsits (return bool)
$this->messageExistsByContent($content);
$this->messageExists($content);

// Get all messages (return EmailMessage[])
$this->getAllMessages();

// Clear inbox (return bool)
$this->clearInbox();
$this->emptyInbox();