Error Mailer for Laravel
Error Mailer for Laravel 5.2, (*1)
Laravel Error Mailer can be installed via Composer by requiring the alverated/laravel-error-mailer
package in your project's composer.json
., (*3)
{ "require": { "alverated/laravel-error-mailer": "dev-master" } }
Register the service provider with the application. Open up config/app.php
and find the providers
key., (*4)
'providers' => [ // ... Alverated\LaravelErrorMailer\ErrorMailerServiceProvider::class, ],
Publish the configurations Run this on the command line from the root of your project., (*5)
$ php artisan vendor:publish
A configuration and blade file will be publish to config/laravel-error-mailer.php
and views/vendor/mailer.blade.php
.
Update your settings in the generated configuration file., (*6)
Open app/Exceptions/Handler.php
and import Alverated\LaravelErrorMailer\ErrorMailer
, (*7)
//... use Alverated\LaravelErrorMailer\ErrorMailer;
and add these two lines of codes to public function report(Exception $e)
below parent::report($e);
, (*8)
public function report(Exception $e) { parent::report($e); // add this code if ($this->shouldReport($e)) { $err = new ErrorMailer($e); $err->sendError(); } }
Add this to your composer.json if you're using any of these drivers, (*9)
{ "require": { "guzzlehttp/guzzle": "~5.3|~6.0", "aws/aws-sdk-php": "~3.0" } }