PHPackages                             daviddel/mailcatcher - 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. daviddel/mailcatcher

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

daviddel/mailcatcher
====================

A library to access MailCatcher

v0.2.0(12y ago)0381MITPHPPHP &gt;=5.3.3

Since Jul 9Pushed 11y ago1 watchersCompare

[ Source](https://github.com/daviddel/mailcatcher)[ Packagist](https://packagist.org/packages/daviddel/mailcatcher)[ RSS](/packages/daviddel-mailcatcher/feed)WikiDiscussions master Synced 1mo ago

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

MailCatcher for PHP
===================

[](#mailcatcher-for-php)

[![Build status](https://camo.githubusercontent.com/8ab5d5e10a7d20121b2d55eadc93409c6ab8864735923e962264121ccd309bc7/68747470733a2f2f7472617669732d63692e6f72672f616c6578616e64726573616c6f6d652f6d61696c636174636865722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/alexandresalome/mailcatcher)STILL IN DEVELOPMENT

Integrates [MailCatcher](http://mailcatcher.me) in your PHP application. MailCatcher is a simple SMTP server with an HTTP API, and this library aims to integrate it to make it easy to use it with PHP.

Behat extension
---------------

[](#behat-extension)

This library provides a Behat extension to help you test mails in your application.

To use it, you first need to be sure [MailCatcher](http://mailcatcher.me) is properly installed and running.

First, configure in your `behat.yml`:

```
default:
    extensions:
        Alex\MailCatcher\Behat\MailCatcherExtension\Extension:
            url: http://localhost:1080
            purge_before_scenario: true
```

### Available steps

[](#available-steps)

This extension provides you mail context in your tests. To use assertions, you must first **open a mail** using criterias.

Once it's opened, you can make **assertions** on it and **click** in it.

**Server manipulation**

Deletes all messages on the server

> When I purge mails

**Mail opening**

> When I open mail from "**foo@example.org**"
>
> When I open mail containing "**a message**"
>
> When I open mail to "**me@example.org**"
>
> When I open mail with subject "**Welcome, mister Bond!**"

**Assertion**

Verify nomber of messages sent to the server:

> Then **1** mail should be sent
>
> Then **13** mails should be sent

Verify text presence in message:

> Then I should see "**something**" in mail
>
> Then I should see "**something else**" in mail

Client API
----------

[](#client-api)

Browse easily your API with the integrated SDK:

```
$client = new Alex\MailCatcher\Client('http://localhost:1080');

// Returns all messages
$messages = $client->search();

// Count messages
$client->getMessageCount();

// Filter messages
$messages = $client->search(array(
    'from'        => 'bob@example.org',
    'to'          => 'alice@example.org',
    'subject'     => 'Bla',
    'contains'    => 'Hello',
    'attachments' => true,
    'format'      => 'html',
), $limit = 3);

// Search one message
$message = $client->searchOne(array('subject' => 'Welcome'));
```

**Message API**

```
// Message API, get the content of a message
$subject = $message->getSubject();
$plainTextBody = $message->getPart('text/plain')->getContent();
$htmlBody = $message->getPart('text/html')->getContent();

// Message API, return a Person object or an array of Person object
$person  = $message->getFrom();
$persons = $message->getRecipients();

// Person API
$person = $message->getFrom();

$name = $person->getName(); // null means not provided
$mail = $person->getMail();

// Attachments
$message->hasAttachments();
$message->getAttachments();
```

**Attachment API**

```
// Attachment API
$attachment->getFilename();
$attachment->getSize();
$attachment->getType();
$attachment->getContent();
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% 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 ~90 days

Total

2

Last Release

4605d ago

### Community

Maintainers

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

---

Top Contributors

[![mattparker](https://avatars.githubusercontent.com/u/112342?v=4)](https://github.com/mattparker "mattparker (9 commits)")[![daviddlv](https://avatars.githubusercontent.com/u/1759582?v=4)](https://github.com/daviddlv "daviddlv (2 commits)")[![lyrixx](https://avatars.githubusercontent.com/u/408368?v=4)](https://github.com/lyrixx "lyrixx (1 commits)")

###  Code Quality

TestsBehat

### Embed Badge

![Health badge](/badges/daviddel-mailcatcher/health.svg)

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

###  Alternatives

[minishlink/web-push

Web Push library for PHP

1.9k12.0M53](/packages/minishlink-web-push)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[spatie/url-signer

Generate a url with an expiration date and signature to prevent unauthorized access

4422.3M16](/packages/spatie-url-signer)[mattketmo/email-checker

Throwaway email detection library

2742.0M5](/packages/mattketmo-email-checker)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[eduardokum/laravel-mail-auto-embed

Library for embed images in emails automatically

1702.0M5](/packages/eduardokum-laravel-mail-auto-embed)

PHPackages © 2026

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