PHPackages                             elegasoft/mailbox-router - 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. elegasoft/mailbox-router

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

elegasoft/mailbox-router
========================

A Boilerplate for registering and managing Mailboxes with beyondcode/laravel-mailbox

v1.4.1(1y ago)149↓100%MITPHPPHP ^7.1|&gt;=8.0 &lt;9.0

Since Dec 29Pushed 1y ago1 watchersCompare

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

READMEChangelogDependencies (4)Versions (8)Used By (0)

Laravel Mailbox Route Registration
==================================

[](#laravel-mailbox-route-registration)

This package extends [beyondcode/laravel-mail](https://github.com/beyondcode/laravel-mailbox) by providing a simple syntax to register mail handlers in a routes file which is outside of a service provider.

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

[](#installation)

You can install the package via composer:

```
composer require elegasoft/mailbox-router
```

Usage
-----

[](#usage)

First publish the route file stub to `routes/mail.php`:

```
php artisan mailboxes:install
```

(Optional) generate a mailbox to handle a route (i.e. `App\Mailboxes\MyMailbox`):

```
php artisan make:mailbox MyMailbox
```

Then define mailboxes to handle incoming mail:

```
// routes/mail.php

return [
    /*
     * Map emails sent from a specific address to a class which
     * will be invoked to process the incoming email message.
     *
     * For example: 'from@test.org' => ExampleMailbox::class
     */

    'from' =>  [
            'example@example.org'  => MyMailbox::class,
            'example2@example.org' => MyMailbox::class,
        ],

    /*
     * Map emails sent to a specific address to a class which
     * will be invoked to process the incoming email message.
     *
     * For example: 'to@test.org' => ExampleMailbox::class
     */

    'to' => [],

    /*
     * Map emails cc'd to a specific address to a class which
     * will be invoked to process the incoming email message.
     *
     * For example: 'cc@test.org' => ExampleMailbox::class
     */

    'cc' => [],

    /*
     * Map emails containing a specific subject to a class which
     * will be invoked to process the incoming email message.
     *
     * For example: 'This Subject' => ExampleMailbox::class
     */

    'subject' => [],

    /*
     * Only when an email does not match any of the preceding
     * invoke this class to catch the email for processing.
     *
     * For example: ExampleFallbackMailbox::class,
     */

    'fallback' => ExampleFallbackMailbox::class,

    /*
     * Regardless of when an email matches any of the preceding
     * always invoke this class to process the email message.
     *
     * For example: ExampleCatchAllMailbox::class,
     */

    'catchAll' => ExampleCatchAllMailbox::class,
];
```

The `MailboxRouterServiceProvider::class` will automatically bind each of the mail routes and invoke the classes or callbacks which when required to process an email which matches the registration.

#### Known Incompatibilities

[](#known-incompatibilities)

You cannot use `Regular Expression Contraints` as define in the [beyondcode/laravel-mailbox docs](https://beyondco.de/docs/laravel-mailbox/basic-usage/mailboxes#regular-expression-constraints).

---

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance50

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~313 days

Recently: every ~392 days

Total

6

Last Release

388d ago

PHP version history (3 changes)v1.0PHP ^7.1

v1.2PHP ^7.1|^8.0

v1.4.1PHP ^7.1|&gt;=8.0 &lt;9.0

### Community

Maintainers

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

---

Top Contributors

[![elegasoft](https://avatars.githubusercontent.com/u/16218581?v=4)](https://github.com/elegasoft "elegasoft (9 commits)")

---

Tags

laravelroutermailboxelegasoft

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/elegasoft-mailbox-router/health.svg)

```
[![Health](https://phpackages.com/badges/elegasoft-mailbox-router/health.svg)](https://phpackages.com/packages/elegasoft-mailbox-router)
```

###  Alternatives

[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[mckenziearts/laravel-notify

Flexible flash notifications for Laravel

1.7k1.1M5](/packages/mckenziearts-laravel-notify)[fedeisas/laravel-mail-css-inliner

Inline the CSS of your HTML emails using Laravel

5974.6M3](/packages/fedeisas-laravel-mail-css-inliner)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[propaganistas/laravel-disposable-email

Disposable email validator

5762.6M6](/packages/propaganistas-laravel-disposable-email)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)

PHPackages © 2026

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