1- # Laravel-Exception-Notifier | A Laravel Excpetions Email Notification [ Package] ( https://packagist.org/packages/jeremykenedy/laravel-exception-notifier ) | v0 .0.2
1+ # Laravel-Exception-Notifier | A Laravel Excpetions Email Notification [ Package] ( https://packagist.org/packages/jeremykenedy/laravel-exception-notifier ) | v1 .0.0
22
33[ ![ Total Downloads] ( https://poser.pugx.org/jeremykenedy/laravel-exception-notifier/d/total.svg )] ( https://packagist.org/packages/jeremykenedy/laravel-exception-notifier )
44[ ![ Latest Stable Version] ( https://poser.pugx.org/jeremykenedy/laravel-exception-notifier/v/stable.svg )] ( https://packagist.org/packages/jeremykenedy/laravel-exception-notifier )
@@ -26,17 +26,74 @@ Laravel exception notifier will send an email of of the error along with the sta
2626 jeremykenedy\laravelexceptionnotifier\LaravelExceptionNotifier::class,
2727 ```
2828
29- 3. Publish the packages language files by running the following from your projects root folder:
29+ 3. Publish the packages view, mailer, and config files by running the following from your projects root folder:
3030
3131 ```
3232 php artisan vendor:publish --tag=laravelexceptionnotifier
3333 ```
3434
35- 5. Configure your email settings in the `.env` file.
35+ 4. In `App\Exceptions/Handler.php replace the `report()` method with:
3636
37- 5. Add the following (optional) settings to your `.env` file and enter your settings:
37+ ```
38+ /**
39+ * Report or log an exception.
40+ *
41+ * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
42+ *
43+ * @param \Exception $exception
44+ * @return void
45+ */
46+ public function report(Exception $exception)
47+ {
48+
49+ $enableEmailExceptions = config('exceptions.emailExceptionEnabled');
50+
51+ if ($enableEmailExceptions === "") {
52+ $enableEmailExceptions = config('exceptions.emailExceptionEnabledDefault');
53+ }
54+
55+ if ($enableEmailExceptions) {
56+ if ($this->shouldReport($exception)) {
57+ $this->sendEmail($exception);
58+ }
59+ }
60+
61+ parent::report($exception);
62+ }
63+ ```
64+
65+ 5. In `App\Exceptions/Handler.php the method `sendEmail()`:
66+
67+ ```
68+ /**
69+ * Sends an email upon exception.
70+ *
71+ * @param \Exception $exception
72+ * @return void
73+ */
74+ public function sendEmail(Exception $exception)
75+ {
76+ try {
77+
78+ $e = FlattenException::create($exception);
79+ $handler = new SymfonyExceptionHandler();
80+ $html = $handler->getHtml($e);
81+
82+ Mail::send(new ExceptionOccured($html));
83+
84+ } catch (Exception $exception) {
3885
39- * Note: the defaults for these are located in `config/exception.php`
86+ dd($exception);
87+
88+ }
89+ }
90+ ```
91+
92+ 6. Configure your email settings in the `.env` file.
93+
94+ 7. Add the following (optional) settings to your `.env` file and enter your settings:
95+
96+ * **Note:** the defaults for these are located in `config/exception.php`
4097
4198 ```
4299 EMAIL_EXCEPTION_ENABLED=false
@@ -47,6 +104,10 @@ Laravel exception notifier will send an email of of the error along with the sta
47104 EMAIL_EXCEPTION_SUBJECT=''
48105 ```
49106
107+ ## Screenshots
108+
109+ 
110+
50111## License
51112
52113Laravel-Exception-Notifier | A Laravel Excpetions Email Notification Package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)
0 commit comments