Download the PHP package lecodeurdudimanche/laravel-email-listener without Composer
On this page you can find all versions of the php package lecodeurdudimanche/laravel-email-listener. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lecodeurdudimanche/laravel-email-listener
More information about lecodeurdudimanche/laravel-email-listener
Files in lecodeurdudimanche/laravel-email-listener
Package laravel-email-listener
Short Description Simple library to do actions when receiving emails, desgined to work with Laravel
License MIT
Informations about the package laravel-email-listener
Laravel Email Listener
A simple library to do actions when receiving emails, desgined to work with Laravel
Installation
Via composer :
You will need to install and enable some php
extensions (php-imap
, php-mbstring
and php-mcrypt
).
With Ubuntu :
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 :
Next, modify the accounts
configuration to add your own accounts.
This library uses laravel-imap for IMAP and POP communication, so if you need more help about IMAP and POP configuration take a look at their documentation.
Basic usage
In the schedule() method of your App\Console\Kernel
class, add this line :
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 :
You can now bind that action to an EmailListener
:
And then run it or save it :
For instance, this is the code to add an action to an existing listener and then save it :
You can load filters individually from JSON with the Filter::load()
function and save them with the Filter::save()
fonction like so :
Description of the expected format :
An example can be found in the tests directory.
Full API
Coming soon
All versions of laravel-email-listener with dependencies
webklex/laravel-imap Version ^1
ext-imap Version *
ext-mbstring Version *
laravel/framework Version >=5.2 || >=6