laravel-status maintained by bhhaskin
Description
Health check API endpoint for Laravel applications.
Author
Last update
2025/11/06 08:25
(dev-main)
License
Downloads
25
Tags
Laravel Status
A simple Laravel package that provides a health check API endpoint for monitoring your application's status.
Features
- Simple
/healthendpoint that returns JSON status - Database connectivity check
- Cache connectivity check
- Returns HTTP 200 for healthy, 503 for unhealthy
- Configurable endpoint path and checks
- Auto-discovery for Laravel
Installation
Install via Composer:
composer require bhhaskin/laravel-status
The package will automatically register itself via Laravel's package auto-discovery.
Usage
Once installed, the package automatically registers a /health endpoint that returns:
Healthy Response (200):
{
"status": "ok"
}
Unhealthy Response (503):
{
"status": "error"
}
Simply make a GET request to /health to check your application's status.
Configuration
Publish the configuration file (optional):
php artisan vendor:publish --tag=laravel-status-config
This creates config/status.php with the following options:
return [
// Enable or disable the status check endpoint
'enabled' => env('STATUS_CHECK_ENABLED', true),
// The path for the status check endpoint
'path' => env('STATUS_CHECK_PATH', 'health'),
// Middleware to apply to the status check endpoint
'middleware' => [],
// Configure which health checks to run
'checks' => [
'database' => env('STATUS_CHECK_DATABASE', true),
'cache' => env('STATUS_CHECK_CACHE', true),
],
];
Environment Variables
You can configure the package using environment variables:
STATUS_CHECK_ENABLED=true
STATUS_CHECK_PATH=health
STATUS_CHECK_DATABASE=true
STATUS_CHECK_CACHE=true
Testing
Run the test suite:
composer test
Requirements
- PHP 8.1 or higher
- Laravel 10.x or 11.x
License
This package is open-sourced software licensed under the MIT license.