|
| 1 | +# Error Mailer |
| 2 | + |
| 3 | +Receive instant alerts to stay informed about errors occurring on your website and act swiftly to enhance its stability. |
| 4 | +This Laravel package simplifies the sending of emails containing detailed error information, allowing you to effectively |
| 5 | +monitor your application's health. |
| 6 | + |
| 7 | +## Installation |
| 8 | + |
| 9 | +To get started with Error Mailer, follow these steps: |
| 10 | + |
| 11 | +1. Install the package using Composer: |
| 12 | + |
| 13 | +```sh |
| 14 | +composer require hugomyb/error-mailer -W |
| 15 | +``` |
| 16 | + |
| 17 | +The -W flag is used to update your composer.json file to add the package as a requirement. |
| 18 | + |
| 19 | +2. Add the Error Mailer service provider to the providers array in your `config/app.php` file: |
| 20 | + |
| 21 | +```php |
| 22 | +'providers' => [ |
| 23 | + // ... |
| 24 | + \Hugomyb\ErrorMailer\ErrorMailerServiceProvider::class, |
| 25 | +], |
| 26 | +``` |
| 27 | + |
| 28 | +3. Publish the package's configuration file : |
| 29 | + |
| 30 | +```sh |
| 31 | +php artisan error-mailer:publish-config |
| 32 | +``` |
| 33 | + |
| 34 | +This will create a `config/error-mailer.php` file in your Laravel project. |
| 35 | + |
| 36 | +```php |
| 37 | +return [ |
| 38 | + 'email' => [ |
| 39 | + 'recipient' => ' [email protected]', |
| 40 | + 'subject' => 'Une erreur est survenue - ' . env('APP_NAME'), |
| 41 | + ], |
| 42 | +]; |
| 43 | +``` |
| 44 | + |
| 45 | +## Configuration |
| 46 | + |
| 47 | +After publishing the configuration file, you can modify it to suit your needs. Open config/error-mailer.php and |
| 48 | +customize the following options: |
| 49 | + |
| 50 | +`'recipient'`: Set the email address where error notifications will be sent. |
| 51 | + |
| 52 | +`'subject'`: Define the subject line for error notification emails. You can use placeholders like `env('APP_NAME')` to |
| 53 | +dynamically include your application's name. |
| 54 | + |
| 55 | +<hr/> |
| 56 | + |
| 57 | +> ⚠️ **IMPORTANT : Make sure to configure a mail server in your .env file :** |
| 58 | +
|
| 59 | +```sh |
| 60 | +MAIL_MAILER=smtp |
| 61 | +MAIL_HOST=your-smtp-host.com |
| 62 | +MAIL_PORT=587 |
| 63 | +MAIL_USERNAME=your-smtp-username |
| 64 | +MAIL_PASSWORD=your-smtp-password |
| 65 | +MAIL_ENCRYPTION=tls |
| 66 | +``` |
| 67 | + |
| 68 | +If the mail server is not configured in the `.env` file, email notifications will not be sent. |
| 69 | + |
| 70 | +## Usage |
| 71 | + |
| 72 | +Once Error Mailer is configured, it will automatically send email notifications when errors occur in your Laravel |
| 73 | +application. The package provides detailed error information in the email content, allowing you to quickly identify and |
| 74 | +resolve issues. |
| 75 | + |
| 76 | +## License |
| 77 | + |
| 78 | +This package is open-sourced software licensed under the [MIT license](https://opensource.org/license/mit/). |
0 commit comments