spatie/laravel-health
Monitor your Laravel app’s health by registering checks (disk space, etc.) with warning/fail thresholds. Get notified via mail or Slack when checks degrade, and extend with custom checks for proactive alerting.
The package contains a controller Spatie\Health\Http\Controllers\HealthCheckJsonResultsController that can be used the render the latest results of all checks as JSON. Simply use that controller in your routes on any URL you desire.
use Spatie\Health\Http\Controllers\HealthCheckJsonResultsController
Route::get('health', HealthCheckJsonResultsController::class);
This controller will respond with JSON to any request that accepts JSON.
If you don't want these results to be public, be sure to take care of authorization yourself.
If you want to run the checks in the same request, you can pass the fresh query parameter.
https://example.com/health?fresh
This way you'll see the latest results in the JSON.
By default, a 200 response will be returned regardless of the results. You can change the status code that
will be returned if a check fails using the health.json_results_failure_status config value.
How can I help you explore Laravel packages today?