Skip to content
Package to send email notification when something goes wrong
Branch: master
Clone or download
Latest commit 4e05f15 Feb 7, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
config update readme and add translation Oct 24, 2016
src update for laravel 5.4 Feb 7, 2017
.gitignore initial commit Oct 8, 2016 update readme and license Jan 24, 2017 update readme and license Jan 24, 2017 update for laravel 5.4 Feb 7, 2017
composer.json update for laravel 5.4 Feb 7, 2017

English description | Russian description

Laravel 5 Error Mailer

Latest Stable Version Latest Unstable Version License

This package allows to enable and set up email alerts in case errors appear.



Setup this package with composer using the following command:

composer require bwt-team/laravel-error-mailer

Setup in Laravel

After composer update add service provider into providers in config/app.php.


This service provider will enable with an option to publish config file to update package settings depending on your needs. After publication this service provider can be disabled, it is not needed for package work. For publication please use:

php artisan vendor:publish --provider="BwtTeam\LaravelErrorMailer\Providers\ErrorMailerServiceProvider" --tag=config

Also, to make package work please register the setup class in bootstrap/app.php. Registration should happen before Application sample is returned.


Setup in Lumen

To send email messages you can use laravel component or create a class for sending yourself by initializing class, which implements \Swift_Transport interface. To set up laravel component:

  • setup component using the following command: composer require illuminate/mail
  • copy config file into config directory, which is stored in root catalogue (or create the directory yourself).
  • Copy config file vendor/bwt-team/laravel-error-mailer/config/error-mailer.php into config directory, which is stored in root directory (or create it yourself if it is missing) and set it up according to your needs.
  • enable service provider in bootstrap/app. $app->register(\Illuminate\Mail\MailServiceProvider::class);
  • setup settings from configuration file. $app->configure('mail'); $app->configure('error-mailer');

To enable sending email alerts you need to create a class instance \BwtTeam\LaravelErrorMailer\Configurators\MailConfigurator in bootstrap/app, its constructor looks like following:

 public function __construct($subject, $to, $from, array $processors = [], $logLevel = Logger::ERROR, \Swift_Transport $sendmailTransport = null)

This class is responsible for sending alert emails by mail but enabling it will disable writing logs into file, which is enabled in lumen by default. In order not to disable writing you need to create a class instance \BwtTeam\LaravelErrorMailer\Configurators\FileConfigurator. Class constructor looks like the following:

 public function __construct($file = null, $logLevel = Logger::DEBUG)

After that you need to pass this instance into with method in \BwtTeam\LaravelErrorMailer\Configurators\MailConfiguratorclass. Each configuration class has options to work with monologue processors. For this you need to pass process instance to class name into constructor or add with the help of addProcessors method. In addition to standard monologue processors, the following out-of-box processors are available:


When component is set up you need to pass it to configureMonologUsing method in Application class before it is returned.
Final setup will look like this:

$configurator = new \BwtTeam\LaravelErrorMailer\Configurators\MailConfigurator('subject', '', '');
$configurator->with(new \BwtTeam\LaravelErrorMailer\Configurators\FileConfigurator());


This package is using MIT.

You can’t perform that action at this time.