jmrashed / laravel-health-check
Advanced Laravel package for health check and performance monitoring
Requires
- php: ^8.0
- guzzlehttp/guzzle: ^7.0
- illuminate/support: ^9.0
README
Advanced Laravel package for health check and performance monitoring.
Table of Contents
Installation
You can install the package via Composer:
composer require jmrashed/laravel-health-check
After installing, publish the configuration file:
php artisan vendor:publish --provider="Jmrashed\HealthCheck\HealthCheckServiceProvider"
Usage
Configuration
Modify the configuration file located at config/health-check.php
to customize your health check settings.
Running Health Checks
You can run health checks manually using the command:
php artisan health:check
You can also set up a scheduled command to automate this.
Logging Health Checks
Health check results are logged in the database. You can view logs by visiting:
/health-check/logs
This will display all the health check logs for monitoring and debugging.
Notifications
Set up notifications to get alerted when a health check fails. Notifications can be configured in the HealthCheckNotification
class.
Middleware
You can apply the health check middleware to your routes to ensure they are always monitored:
Route::middleware('health.check')->group(function () { // Your routes });
Testing
Run the tests using PHPUnit:
vendor/bin/phpunit
Make sure to set up your testing environment according to Laravel’s testing guidelines.
Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
License
This package is licensed under the MIT License. See the LICENSE file for details.