masgeek/laravel-health-checker
Composer 安装命令:
composer require masgeek/laravel-health-checker
包简介
Laravel health checker helper
README 文档
README
A lightweight, configurable health-check endpoint for Laravel 12+.
Provides real-time diagnostics for critical services like database, cache, Redis, mail, queues, storage, and system resources.
🚀 Features
- Modular, configurable health checks
- JSON endpoint for integration with monitoring tools (Prometheus, Grafana, Kubernetes, etc.)
- Built-in support for:
- Database connection and schema checks
- Redis availability
- Cache read/write
- File storage read/write
- Queue configuration
- Mail transport
- Disk usage (human-readable)
- Pending migrations
- Environment configuration
- Loki server health
- Log file write access
📦 Installation
Install via Composer:
composer require masgeek/laravel-health-checker
⚙️ Configuration
Publish the configuration file:
php artisan vendor:publish --tag=healthcheck-config
Then edit config/healthcheck.php to configure your health checks:
return [ 'core' => [ 'database' => env('HEALTHCHECK_DATABASE', true), 'cache' => env('HEALTHCHECK_CACHE', true), 'queue' => env('HEALTHCHECK_QUEUE', true), 'mail' => env('HEALTHCHECK_MAIL', false), 'migrations' => env('HEALTHCHECK_MIGRATIONS', true), 'env-config' => env('HEALTHCHECK_ENV_CONFIG', true), ], 'infrastructure' => [ 'redis' => env('HEALTHCHECK_REDIS', false), 'storage' => env('HEALTHCHECK_STORAGE', true), 'disk-space' => env('HEALTHCHECK_DISK_SPACE', true), 'logging' => env('HEALTHCHECK_LOGGING', true), 'loki' => env('HEALTHCHECK_LOKI', false), ], 'services' => [ 'loki_url' => env('LOKI_URL', null), ], ];
Each key corresponds to a built-in health check.
Disable what you don’t need by setting it to false.
🧠 Usage
A new route will be automatically registered:
GET /health
Example response
{
"status": "healthy",
"timestamp": "2025-10-07T10:00:00Z",
"checks": {
"database": {
"status": "UP",
"database": "fuelrod",
"schema": "public",
"total_tables": 54
},
"redis": {
"status": "UP",
"version": "7.2.4"
},
"disk-space": {
"status": "UP",
"total_space": "500 GB",
"free_space": "230 GB",
"used_percentage": "54%"
}
}
}
🧩 Customization
-
To disable specific checks, update config/healthcheck.php.
-
To check Loki server health, define LOKI_URL in .env:
LOKI_URL=http://loki:3100
masgeek/laravel-health-checker 适用场景与选型建议
masgeek/laravel-health-checker 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 306 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 10 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 masgeek/laravel-health-checker 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 masgeek/laravel-health-checker 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 306
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-08