Download the PHP package nagy/health-check without Composer
On this page you can find all versions of the php package nagy/health-check. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package health-check
health-checker
Monitor your laravel server and application health and get notified immediately.
Features
- Dashboard
- APIs
- Artisan command
- Schedule
- Notifications
- Implemented Checkers
- ProcessCount
- Expression
- ServerAvailability
- Custom Checkers
Install
publish config files and resources
Dashboard
http://localhost/health-check/dashboard

APIs
get all checkers: http://localhost/health-check/checkers
response:
get all check results http://localhost/health-check
response:
get specific checker result http://localhost/health-check/checker-name
response:
Artisan Command

Schedule
Package will run peridcally in the background to check you application and server health. the frequency is being set based on the laravel frequency options
Notifications
First the package is enabled by checking notifications => [ 'enabled' => true]
in the configuration file, then check if the result type is exists on notifications => 'notify_on'
The current suporrted notification channels is MailChannel
, you can add your custom channel by creating a class with a notify method.
The notify method accepts a collection of results.
Checkers
The package shipped with two global checkers
ProcessCount
used to check the count of running process, for exampl, you need to check that at least a 10 workers are ruuning, then add a new elemet to the checkers
in the configuration file
Note The package consider the checker key as the checker name, so it's highly recommend to name avoid the spaces in the checker name.
Expression
Expression checker evalutes a Specfic expression, the evalution should be true
to consider the it as healthy.
ServerAvailability
Check if the provided host
is accessable via a specific port (port is optional, default is 80)
Custom Checkers
in case you need to build your own checkers then all you need to do is creating a class that extends from AbstractBaseChecker
and implements HealthCheckInterface
.
then you have to implement methods check
, isHealthy
and getMessage
class CustomChecker extends AbstractBaseChecker implements HealthCheckInterface
{
public function check(): Result
{
if ($this->isHealthy()) {
return $this->makeHealthyResult();
} else {
return $this->makeUnHealthyResult();
// return $this->makeUnHealthyResult(Result::WARNING_STATUS);
}
}
public function isHealthy(): bool
{
return true;
}
public function getMessage(): string
{
// return your message to be attached in case of unhealthy result
}
}