Download the PHP package darshan/exceptionemail without Composer
On this page you can find all versions of the php package darshan/exceptionemail. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download darshan/exceptionemail
More information about darshan/exceptionemail
Files in darshan/exceptionemail
Package exceptionemail
Short Description An easy way to send emails with stack trace whenever an exception occurs on the server for Laravel Applications.
License MIT
Informations about the package exceptionemail
Laravel Exception Notifications
An easy-to-use package for sending email notifications with stack traces whenever an exception occurs in your Laravel application.
Installation Guide
1. Install via Composer
To install the package, run the following Composer command:
2. Configure Laravel
Breaking Changes for Laravel 11: Exception Handling in a Custom Service Provider
In Laravel 11, exception handling logic should be placed in a custom service provider. Follow these steps to set it up:
- Create a Custom Service Provider:
Create a new service provider that will handle exceptions in your application. Add the following code in app/Providers/ExceptionServiceProvider.php
:
- Register the Service Provider:
In bootstrap/providers.php
, register your custom ExceptionServiceProvider
by adding it to the providers
array:
Add ExceptionEmail's Exception Capturing (for version of Laravel below 11 like 8,9,10)
In order to capture exceptions and send emails (for Laravel versions prior to 11 or if you prefer using Handler.php
), modify the report
method in your app/Exceptions/Handler.php
file:
3. Publish the Configuration File
Publish the ExceptionEmail configuration file by running the following Artisan command:
This will create a configuration file at config/exceptionemail.php
.
Configuration
Silent Mode
By default, the package is configured with 'silent' => true
to prevent sending exception emails in development environments, especially when 'debug' => true
is enabled in Laravel.
You can control this behavior with the following configuration option:
To enable email notifications when exceptions occur, set IS_EXCEPTION_EMAIL_SILENT=false
in your .env
file.
Capture Exceptions
You can specify which types of exceptions should trigger email notifications. By default, the package includes Symfony\Component\Debug\Exception\FatalErrorException::class
.
To capture all exceptions, you can use the wildcard '*'
:
Ignored Exceptions
You may define exceptions that should not trigger email notifications. This is done by adding them to the ignored_exception
array.
For example, to ignore FatalErrorException
, use the following:
Usage in Handler.php
Update the report
method in app/Exceptions/Handler.php
to incorporate ignored exceptions:
Recipients
Specify the email addresses that should receive the exception notifications by updating the to
array:
Ignored Bots
You can configure the package to ignore errors triggered by bots, like search engine crawlers. The default configuration includes common bots such as:
Customizing Emails
To customize the subject and body of the error notification emails, publish the email templates by running:
Note: Only run this command once to avoid overwriting custom changes.
The email views will be published to resources/views/vendor/exceptionemail
. You can modify the templates as needed, and you have access to the $exception
object in the views.
Testing the Integration
To verify that ExceptionEmail is correctly set up and working, use the following Artisan command:
This command will throw a Webmonks\ExceptionEmail\Exceptions\DummyException
, and the package will capture and send it as an email. If everything is set up correctly, you should receive the test email.
Security
If you discover any security issues, please contact us directly via email at [email protected], rather than opening an issue on GitHub.
Credits
- Darshan Baraiya
- Squareboat
- All Contributors
About Webmonks
Webmonks is a product development startup based in Ahmedabad, India. You can explore all our open-source projects on GitHub.
License
This package is open-sourced software licensed under the MIT License.
All versions of exceptionemail with dependencies
illuminate/support Version 8.*|9.*|10.*|11.*
illuminate/view Version 8.*|9.*|10.*|11.*
illuminate/config Version 8.*|9.*|10.*|11.*
illuminate/mail Version 8.*|9.*|10.*|11.*
illuminate/log Version 8.*|9.*|10.*|11.*
illuminate/queue Version 8.*|9.*|10.*|11.*
illuminate/console Version 8.*|9.*|10.*|11.*
symfony/error-handler Version ~5.1|~6.0|~7.0