承接 tarique/laravel-app-monitor 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tarique/laravel-app-monitor

最新稳定版本:1.0.3

Composer 安装命令:

composer require tarique/laravel-app-monitor

包简介

A Laravel package to monitor application downtime and server errors, and send email notifications

README 文档

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.

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-06