illuma-law / healthcheck-redis
Focused redis health check for Spatie's Laravel Health package.
Package info
github.com/eloquage/healthcheck-redis
Language:Blade
pkg:composer/illuma-law/healthcheck-redis
Fund package maintenance!
Requires
- php: ^8.3
- illuminate/contracts: ^12.0||^13.0
- illuminate/database: ^12.0||^13.0
- illuminate/support: ^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
- mrpunyapal/peststan: ^0.2.12
- 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
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-23 13:46:08 UTC
README
Two checks for Spatie Laravel Health: one reports whether the PHP Redis extension is installed, and one pings Redis and reports memory use against its configured maxmemory limit.
Requirements
- PHP 8.3 or later
- Laravel 12 or 13
spatie/laravel-health1.39 or later
Installation
composer require illuma-law/healthcheck-redis
The service provider is discovered automatically. Publish the configuration if you want to change the defaults:
php artisan vendor:publish --tag=healthcheck-redis-config
Set HEALTH_REDIS_REQUIRED=true to fail when the PHP Redis extension is missing. Set HEALTH_REDIS_MEMORY_WARNING_PERCENT=90 to choose the memory usage percentage that triggers a warning. Memory at or above 100% of Redis maxmemory is reported as failed. When maxmemory is unlimited or unavailable, the check reports reachability and any available memory information without calculating a percentage.
Usage
Register the checks in your health service provider:
use IllumaLaw\HealthCheckRedis\RedisExtensionCheck; use IllumaLaw\HealthCheckRedis\RedisMemoryCheck; use Spatie\Health\Facades\Health; Health::checks([ RedisExtensionCheck::new(), RedisMemoryCheck::new() ->connection('default') ->thresholdPercent(90), ]);
RedisExtensionCheck warns when the extension is missing by default. Use RedisExtensionCheck::new()->required() or set HEALTH_REDIS_REQUIRED=true to make that a failure. RedisMemoryCheck warns at its configured threshold and fails when usage reaches maxmemory.
Testing
composer test
composer analyse
vendor/bin/pint --test
License
MIT. See LICENSE.md.
