tarique / laravel-app-monitor
A Laravel package to monitor application downtime and server errors, and send email notifications
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Language:Blade
Requires
- php: ^8.1
- laravel/framework: ^10.0
This package is auto-updated.
Last update: 2025-04-12 14:29:58 UTC
README
Laravel App Monitor
Laravel App Monitor is a package designed to monitor specific HTTP errors in your Laravel application and notify administrators via email. It helps ensure that critical errors (like 500, 502, 503, 504, 413) are promptly reported, allowing administrators to take appropriate action.
Installation
You can install the Laravel App Monitor package via Composer. Run the following command in your terminal:
composer require tarique/laravel-app-monitor
Publish Configuration
To customize settings such as email recipients or error notifications, publish the configuration file:
php artisan vendor:publish --provider="Tarique\LaravelAppMonitor\AppMonitorServiceProvider" --tag=config
This will copy the configuration file to config/appmonitor.php
and app\Jobs\SendMonitorErrorNotification.php
.
Environment Configuration
Set the email address where notifications should be sent in your .env
file:
ADMIN_EMAIL=admin@example.com
Make sure to replace admin@example.com
with the appropriate email address.
Usage
Laravel App Monitor automatically detects and handles specific HTTP errors. Here's how you can use it effectively:
Enable Error Notifications
Ensure that error notifications are enabled in the config/appmonitor.php
file:
return [ 'admin_email' => env('APPMONITOR_ADMIN_EMAIL', 'admin@example.com'), 'notify_on_down' => env('APPMONITOR_NOTIFY_ON_DOWN', true), 'notify_on_error' => env('APPMONITOR_NOTIFY_ON_ERROR', true), 'error_codes' => [500, 502, 503, 504, 413], ];
Customize Email Template (Optional)
If you want to customize the email template used for error notifications, you can publish the default template:
php artisan vendor:publish --provider="Tarique\LaravelAppMonitor\AppMonitorServiceProvider" --tag=views
This will copy the default email template to resources/views/vendor/appmonitor/error_email.blade.php
, where you can modify it to suit your needs.
Configure Queue (Optional)
To avoid delaying frontend responses due to email sending, you can configure Laravel queues. Set the queue connection in your .env
file:
QUEUE_CONNECTION=sync
If you are using QUEUE_CONNECTION as a database you should
QUEUE_CONNECTION=database
Run the migration to create the jobs table:
php artisan queue:table php artisan migrate
Start the queue worker to process jobs asynchronously:
php artisan queue:work
Support
If you encounter any issues or have questions about using Laravel App Monitor, please open an issue on GitHub or contact the package maintainer directly.
License
Laravel App Monitor is open-source software licensed under the MIT license.