PHPackages                             stephanecoinon/mailtrap - 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. stephanecoinon/mailtrap

ActiveLibrary

stephanecoinon/mailtrap
=======================

PHP client for Mailtrap.

v0.2.0(6y ago)837.1k↓50%6MITPHPCI failing

Since Mar 10Pushed 6y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (5)Versions (6)Used By (0)

PHP client for Mailtrap
=======================

[](#php-client-for-mailtrap)

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

[](#installation)

First install this package using composer:

`composer require stephanecoinon/mailtrap`

### Plain Vanilla PHP

[](#plain-vanilla-php)

```
use StephaneCoinon\Mailtrap\Client;
use StephaneCoinon\Mailtrap\Model;

// Instantiate Mailtrap API client
$client = new Client('your_mailtrap_api_token_here');

// Boot API models
Model::boot($client);
```

### Laravel

[](#laravel)

This package includes a Laravel service provider (tested for Laravel v5.4).

Add your Mailtrap API token to your `.env` file.

```
MAILTRAP_API_TOKEN=your_mailtrap_api_token_here
```

Then add mailtrap in your `config/services.php` configuration:

```
'mailtrap' => [
    'token' => env('MAILTRAP_API_TOKEN'),
],
```

Finally, if your app runs on Laravel &lt; 5.5, register the Mailtrap service provider in `config/app.php`:

```
'providers' => [
    // ...

    /*
     * Package Service Providers...
     */
    // ...

    StephaneCoinon\Mailtrap\MailtrapServiceProvider::class,

    // ...
],
```

Otherwise it will be discovered automatically on Laravel &gt;= 5.5.

Usage
-----

[](#usage)

```
use StephaneCoinon\Mailtrap\Inbox;

// Fetch all inboxes
$inboxes = Inbox::all();

// Fetch an inbox by its id
$inbox = Inbox::find(1234);

// Get all messages in an inbox
$messages = $inbox->messages();

// Get a message by its id
$message = $inbox->message(123456789);
$message->htmlBody(); // Get the HTML body (also sets html_body attribute on the message)
$message->textBody(); // Get the plain text body (also sets txt_body attribute on the message)
$message->rawBody(); // Get the raw body (also sets raw_body attribute on the message)
$message->headers(); // Get the headers as an array (also sets headers attribute on the message)

// Get the last (newest) message in an inbox
$newestMessage = $inbox->lastMessage();

// Delete all messages from an inbox
$inbox = $inbox->empty();
$inbox = (new Inbox)->empty(1234); // alternative syntax using the inbox id

// Determine whether the inbox contains a message for a given recipient e-mail
$recipientReceivedMessage = $inbox->hasMessageFor('john@example.com');

// Get message recipients as an array
$recipients = $message->recipientEmails();
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 71.4% 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 ~386 days

Total

4

Last Release

2196d ago

### Community

Maintainers

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

---

Top Contributors

[![sco-tt](https://avatars.githubusercontent.com/u/2326111?v=4)](https://github.com/sco-tt "sco-tt (5 commits)")[![Junker](https://avatars.githubusercontent.com/u/1144095?v=4)](https://github.com/Junker "Junker (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/stephanecoinon-mailtrap/health.svg)

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

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k21](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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