bhhaskin / laravel-status
Health check API endpoint for Laravel applications.
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/bhhaskin/laravel-status
Requires
- php: ^8.1
- illuminate/routing: ^10.0 || ^11.0
- illuminate/support: ^10.0 || ^11.0
Requires (Dev)
- orchestra/testbench: ^8.0 || ^9.0
- pestphp/pest: ^2.0
README
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.