illuma-law / healthcheck-redis
Focused redis health check for Spatie's Laravel Health package.
Fund package maintenance!
v0.1.2
2026-04-20 18:47 UTC
Requires
- php: ^8.3
- illuminate/contracts: ^11.0||^12.0||^13.0
- illuminate/database: ^11.0||^12.0||^13.0
- illuminate/support: ^11.0||^12.0||^13.0
- spatie/laravel-health: ^1.39
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^11.1.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- spatie/laravel-ray: ^1.35
README
A focused redis health check for Spatie's Laravel Health package.
This package provides direct health checks to verify that the PHP redis extension is installed and that your Redis instance is operating within safe memory limits.
Features
- Extension Detection: Checks if the PHP
redisextension is enabled and reports the specific version installed. - Memory Monitoring: Verifies that your Redis instance is not exceeding its
maxmemorylimit (or a custom threshold). - Configurable Strictness: Choose whether a missing extension or high memory usage should return a Warning or a Failure status.
Installation
Require this package with composer:
composer require illuma-law/healthcheck-redis
Usage & Integration
Register the checks inside your application's health service provider (e.g. AppServiceProvider or a dedicated HealthServiceProvider), alongside your other Spatie Laravel Health checks:
1. Redis Extension Check
use IllumaLaw\HealthCheckRedis\RedisExtensionCheck; use Spatie\Health\Facades\Health; Health::checks([ RedisExtensionCheck::new()->required(true), ]);
2. Redis Memory Check
use IllumaLaw\HealthCheckRedis\RedisMemoryCheck; use Spatie\Health\Facades\Health; Health::checks([ RedisMemoryCheck::new() ->connection('default') ->thresholdPercent(90), ]);
Expected Result States
- Ok: The extension is installed and Redis memory usage is within safe limits.
- Warning: The extension is missing (if not required) or Redis memory usage is above the warning threshold.
- Failed: The extension is missing (if required) or Redis has reached its
maxmemorylimit.
Testing
Run the test suite:
composer test
License
The MIT License (MIT). Please see License File for more information.