chocofamilyme/laravel-healthcheck
Composer 安装命令:
composer require chocofamilyme/laravel-healthcheck
包简介
Serves functionality of healthchecks of your application
关键字:
README 文档
README
Health Check library adds new endpoints(routes) to your project which are used to check some services of your application. For example you want to check "Database Connection" of your microservice.
Installation
composer require chocofamilyme/laravel-healthcheck ^2.0
Publishing the configuration (optional)
php artisan vendor:publish --provider="Chocofamilyme\LaravelHealthCheck\Providers\HealthCheckServiceProvider"
Checks
- Database connection check
- Cache write&read check
- Sessions write&read check
- Storage check
Routes
- /health
{
"DB": "OK",
"CACHE": "OK",
"SESSIONS": "CRITICAL",
"STORAGE": "OK"
}
- /health/extended
{
"DB": {
"STATUS": "OK",
"STATUS_BOOL": true,
"MESSAGE": null
},
"CACHE": {
"STATUS": "OK",
"STATUS_BOOL": true,
"MESSAGE": null
},
"SESSIONS": {
"STATUS": "CRITICAL",
"STATUS_BOOL": false,
"MESSAGE": "Connection to tarantool.example.com failed"
},
"STORAGE": {
"STATUS": "OK",
"STATUS_BOOL": true,
"MESSAGE": null
}
}
How to write your custom checks
Create a class which implements Chocofamilyme\LaravelHealthCheck\Services\Checks\ComponentCheckInterface and add it to healthcheck.php config file like
return [ 'componentChecks' => [ 'YOURCUSTOMCHECK' => YourCustomCheck::class ] ]
Responses
There is a configuration param which describes which response class to use to output the response. For example
- /health - Chocofamilyme\LaravelHealthCheck\Responses\Response::class output would look like this
{
"DB": "OK",
"CACHE": "OK",
"SESSIONS": "CRITICAL",
"STORAGE": "OK"
}
- /health - Chocofamilyme\LaravelHealthCheck\Responses\Response::class output would look like this
{
"data": {
"DB": "OK",
"CACHE": "OK",
"SESSIONS": "CRITICAL",
"STORAGE": "OK"
}
}
Feel free to add your responses, if you want for example to output it in a view instead json.
chocofamilyme/laravel-healthcheck 适用场景与选型建议
chocofamilyme/laravel-healthcheck 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 134.55k 次下载、GitHub Stars 达 11, 最近一次更新时间为 2019 年 08 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「status」 「healthcheck」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 chocofamilyme/laravel-healthcheck 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 chocofamilyme/laravel-healthcheck 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 chocofamilyme/laravel-healthcheck 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel Healthchecks is a simple controller class that helps you build your own healthchecks endpoint without issues.
Doctrine implementation of the MetaborStd (Statemachine) for PHP 8.2+
404 'not found' and 403 'forbidden' error handlers. The 404 handler shows custom content for missing pages but not resources like CSS or JS. The 403 handler redirects to a login URL on unauthorized access.
Serves functionality of healthchecks of your application
An expansion pack for Spatie Laravel Health package
Provide status and health api endpoints
统计信息
- 总下载量: 134.55k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2019-08-08