Download the PHP package jtkalkman/laravel-health without Composer
On this page you can find all versions of the php package jtkalkman/laravel-health. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jtkalkman/laravel-health
More information about jtkalkman/laravel-health
Files in jtkalkman/laravel-health
Package laravel-health
Short Description Configurable Laravel health check endpoint with Semonto-compatible JSON output
License MIT
Homepage https://github.com/JTKalkman/laravel-health
Informations about the package laravel-health
Laravel Health
A lightweight, configurable Laravel package that exposes a health check endpoint with Semonto server health monitoring compatible JSON output.
No GUI, just a clean JSON endpoint that tells you and your monitoring tools whether your server is healthy.
Requirements
- PHP 8.3+
- Laravel 12 or 13
Installation
Publish the configuration file:
Configuration
The published config/health.php is the single place to configure everything, which checks to run, thresholds, authentication, caching, and the endpoint route.
Example config/health.php
Environment variables
Add these to your .env:
For local development:
Artisan commands
health:check is useful for debugging on a production server and in deployment pipelines. It returns exit code 0 for ok, 1 for warning, and 2 for error, so a deploy can fail fast if checks are unhealthy.
health:clear only clears the health check result cache (health::results). It does not clear the Laravel config cache.
Finding your mount points
Run the following commands on your server to list available mount points before configuring disk checks:
Add a DiskSpaceCheck and/or DiskSpaceInodeCheck for each mount point you want to monitor.
Built-in checks
| Check | Description | value |
|---|---|---|
DiskSpaceCheck |
Disk space usage for a mount point | % used |
DiskSpaceInodeCheck |
Inode usage for a mount point | % used |
MemoryCheck |
System memory usage | % used |
CpuLoadCheck |
CPU load average (1, 5, or 15 minutes) as % of total capacity | % of capacity |
DatabaseConnectionCheck |
Database connection and query response time | seconds |
DatabaseConnectionCountCheck |
Active DB connections as % of max (MySQL/MariaDB/PostgreSQL) | % used |
CPU load and core count
CPU load thresholds are expressed as a percentage of total CPU capacity. A load of 1.0 per core equals 100% utilisation, so on a 4-core server, a load of 4.0 is 100%. The package detects your core count automatically, so you configure thresholds as percentages regardless of the server's core count:
Multiple database connections
Laravel supports multiple database connections. Add a check for each one you want to monitor:
Custom checks
Extend the HealthCheck abstract class anywhere in your application, no need to touch the vendor folder:
Register it in config/health.php:
The abstract class handles all error cases, if performHealthCheck() throws for any reason, the check returns an error result automatically. Your check only needs to handle the happy path.
JSON response
The endpoint returns a JSON response compatible with Semonto server health monitoring:
Status values
| Status | Meaning |
|---|---|
ok |
Check passed |
warning |
Check passed with warnings |
error |
Check failed or could not run |
The top-level status reflects the worst status across all checks. The HTTP response code is 200 for ok and 503 for anything else.
Security
- The endpoint returns
404for any request that fails authentication or HTTPS requirements, no information is leaked about the endpoint's existence - Secret key comparison uses
hash_equals()to prevent timing attacks - Results are cached to prevent the endpoint from being used as a DoS vector
- Always use HTTPS in production, the secret key travels in a request header
Semonto compatibility
This package produces a standard JSON health endpoint that is compatible with Semonto server health monitoring. The endpoint can also be consumed by any monitoring tool, custom dashboard, or deployment pipeline that can make an HTTP request and parse JSON.
To connect Semonto to your health endpoint, add the endpoint URL in your Semonto server health monitoring settings and configure an access key. Set the same key as HEALTH_CHECK_SECRET in your .env and make sure HEALTH_CHECK_HEADER_NAME matches the header name configured in Semonto, which defaults to health-monitor-access-key.
License
MIT License
Copyright (c) 2026 J.T. Kalkman