PHPackages                             lecodeurdudimanche/laravel-email-listener - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. lecodeurdudimanche/laravel-email-listener

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

lecodeurdudimanche/laravel-email-listener
=========================================

Simple library to do actions when receiving emails, desgined to work with Laravel

2.0.1(6y ago)03MITPHPPHP ^7CI failing

Since Nov 18Pushed 6y ago1 watchersCompare

[ Source](https://github.com/LeCodeurDuDimanche/laravel-email-listener)[ Packagist](https://packagist.org/packages/lecodeurdudimanche/laravel-email-listener)[ RSS](/packages/lecodeurdudimanche-laravel-email-listener/feed)WikiDiscussions master Synced yesterday

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

Laravel Email Listener
======================

[](#laravel-email-listener)

[![Build status](https://github.com/lecodeurdudimanche/laravel-email-listener/workflows/CI/badge.svg)](https://github.com/LeCodeurDuDimanche/laravel-email-listener/actions?query=workflow%3ACI)[![GitHub license](https://camo.githubusercontent.com/2ae1d3b79b10a3111689d45b5e4f5442e2e4294afe54ae69accc8f43f535b7c6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4c65436f64657572447544696d616e6368652f6c61726176656c2d656d61696c2d6c697374656e6572)](https://github.com/LeCodeurDuDimanche/laravel-email-listener/blob/master/License.md)[![Package version](https://camo.githubusercontent.com/f820725b1ea851a1fc476c056454ffb3c740812b5bac404fbfa7b2d926a43ae0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c65636f64657572647564696d616e6368652f6c61726176656c2d656d61696c2d6c697374656e65722e737667)](https://packagist.org/packages/lecodeurdudimanche/laravel-email-listener)[![Downloads](https://camo.githubusercontent.com/c62a49796854f714e53e9770ffefac612faa6b3d2d22849ee968a6287ad9c753/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c65636f64657572647564696d616e6368652f6c61726176656c2d656d61696c2d6c697374656e65722e7376673f636f6c6f723d626c7565)](https://packagist.org/packages/lecodeurdudimanche/laravel-email-listener)

A simple library to do actions when receiving emails, desgined to work with Laravel

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

[](#installation)

Via composer :

```
composer require lecodeurdudimanche/laravel-email-listener
```

You will need to install and enable some `php` extensions (`php-imap`, `php-mbstring` and `php-mcrypt`). With Ubuntu :

```
sudo apt install php*-imap php*-mbstring php*-mcrypt
```

Configuration
-------------

[](#configuration)

You need to set the configuration of your IMAP or POP accounts. First run the following command to publish the configration in your `config` folder :

```
php artisan vendor:publish --provider="Webklex\IMAP\Providers\LaravelServiceProvider"
```

Next, modify the `accounts` configuration to add your own accounts.

This library uses [laravel-imap](https://github.com/Webklex/laravel-imap) for IMAP and POP communication, so if you need more help about IMAP and POP configuration take a look at [their documentation](https://github.com/Webklex/laravel-imap#configuration).

Basic usage
-----------

[](#basic-usage)

In the [schedule()](https://laravel.com/docs/5.7/scheduling#defining-schedules) method of your `App\Console\Kernel` class, add this line :

```
$schedule->call(new EmailListener)->everyfiveMinutes(); // or any other [frequency option](https://laravel.com/docs/5.7/scheduling#schedule-frequency-options)
```

This will cause the `EmailListener` to load actions and filters from the configuration file (whose path must be provided in `email-listener.config-file` configuration value) and then run.

In order to create the configuration programtically, or to use the library without loading anything, you'll need to register `Action`s. First, you'll need to create an `Action` object, that contains a callback to be executed and a filter determining which email will trigger that action :

```
$action = (new Action())
    ->filter((new EmailFilter())
        ->from("an.adress@example.com")
        )
    ->callback($callback);
// callback can be a closure, a array with class and method or a string with format 'class@method'
// Tou can also use the constructor
$action = new Action(
    (new EmailFilter())->from("an.adress@example.com"),
    $callback);
```

You can now bind that action to an `EmailListener` :

```
$emailListener = (new EmailListener())
    ->addAction('imap_client', $action);

// Where 'imap_client' is the name of your IMAP or POP account in config/imap.php file
```

And then run it or save it :

```
$emailListener->run();
$emailListener->save();
```

For instance, this is the code to add an action to an existing listener and then save it :

```
(new EmailListener())
    ->load()
    ->addAction('imap_client', $action)
    ->save();
```

You can load filters individually from JSON with the `Filter::load()` function and save them with the `Filter::save()` fonction like so :

```
// You must either set config("email-listener.config-file") to the path of your JSON file
// or pass the path as the second argument of Filter::load
$filter = Filter::load('fancyFilterName', 'path/to/file.json');
$filter->save('path/to/file.json');
// You can also save the filter with another name like so :
$filter->saveAs('another name', 'path/to/file.json');
```

Description of the expected format :

```
  {
      "actions" : [
        {
            "client" : ,
            "filter" : ,
            "callback" : "class@method"
        },
        ...
      ],
      "filters" : [
           : {
            "type": "email" | "attachment",
            "filters": [
              {
                  "method" : ,
                  "args" :  |
              },
              ...
            ]
            ("attachments" : )(only if type == "email", optional)
          },
          ...
      ]
}

```

An example can be found in the [tests directory](tests/data/filters.json).

Full API
--------

[](#full-api)

*Coming soon*

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 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 ~1 days

Total

2

Last Release

2366d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/91ab2cb172b0a9fc1312802e15daf21497045ca73d7a19c4304c64c78b6acd65?d=identicon)[LeCodeurDuDimanche](/maintainers/LeCodeurDuDimanche)

---

Top Contributors

[![LeCodeurDuDimanche](https://avatars.githubusercontent.com/u/43851820?v=4)](https://github.com/LeCodeurDuDimanche "LeCodeurDuDimanche (12 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lecodeurdudimanche-laravel-email-listener/health.svg)

```
[![Health](https://phpackages.com/badges/lecodeurdudimanche-laravel-email-listener/health.svg)](https://phpackages.com/packages/lecodeurdudimanche-laravel-email-listener)
```

###  Alternatives

[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)

PHPackages © 2026

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