arquivei / laravel-health-checker
Laravel Health Checker
Installs: 38 894
Dependents: 2
Suggesters: 0
Security: 0
Stars: 9
Watchers: 11
Forks: 3
Open Issues: 4
Requires
- php: ^8.0 || ^8.1 || ^8.2 || ^8.3
- laravel/framework: ^10.0 || ^11.0
Requires (Dev)
- mockery/mockery: ^1.3.3
- orchestra/testbench: ^8.0 || ^9.0
- predis/predis: ^1.0
Suggests
- guzzlehttp/guzzle: ~6.0
- predis/predis: ^1.0
This package is auto-updated.
Last update: 2024-12-21 21:14:32 UTC
README
Version Compatibility
Install
composer require arquivei/laravel-health-checker
Usage
Edit the config file config/health-checker.php
see the comments there for more information
Available checkers
database
Tests database connections.cache
Tests for caching datadirectory-permission
Tests permission in directoriesqueue
Tests for queue
How to add a new checker
You only need to extent \Laravel\Health\Checkers\BaseChecker
and add to services in config/health-checker.php
.
Routes and Responses
To access the health status you can use the follow routes:
health/status
Load and list all check services.health/{service_name}/status
Load only the chosen service and show his status.
The response for both cases will be like that:
{
status: {
code: 200,
message: "OK"
},
health_status: [
{
cache: {
is_healthful: true,
message: null
}
},
{
database: {
is_healthful: true,
message: null
}
},
{
directory-permission: {
is_healthful: false,
message: "The directory /application/public/../storage/ is not writable."
}
},
{
queue: {
is_healthful: true,
message: null
}
}
]
}
Command usage
You can use the follow commands to check healthy in your cli application:
php artisan application-health:check-health
Or
php artisan application:health-check
Development
We provide docker images to help set up the development environment. So, in order to build the images, install the dependencies and run the tests, you may execute the command:
make
After the initial setup you can use the bin/php
and bin/composer
scripts (wrappers for the docker images) to run the tests and install
new dependencies.