illuma-law / healthcheck-typesense
A Typesense health check for Spatie's Laravel Health package.
Package info
github.com/eloquage/healthcheck-typesense
Language:Blade
pkg:composer/illuma-law/healthcheck-typesense
Requires
- php: ^8.3
- illuminate/contracts: ^12.0||^13.0
- illuminate/support: ^12.0||^13.0
- spatie/laravel-health: ^1.39
- spatie/laravel-package-tools: ^1.16
- typesense/typesense-php: ^6.0
Requires (Dev)
- larastan/larastan: ^3.1
- laravel/pint: ^1.21
- mrpunyapal/peststan: ^0.2.12
- nunomaduro/collision: ^8.6
- orchestra/testbench: ^10.1||^11.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.39
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-23 13:51:33 UTC
README
A Spatie Laravel Health check that
calls Typesense’s /health endpoint and reports reachability and response time.
Requirements
- PHP 8.3 or later
- Laravel 12 or 13
- Spatie Laravel Health 1.39 or later
Install and configure
composer require illuma-law/healthcheck-typesense php artisan vendor:publish --tag=healthcheck-typesense-config
Set the client connection values in .env:
TYPESENSE_API_KEY=your-api-key TYPESENSE_HOST=localhost TYPESENSE_PORT=8108 TYPESENSE_PROTOCOL=http TYPESENSE_CONNECTION_TIMEOUT_SECONDS=2
The default slow-response warning threshold is five seconds. Change
timeout_seconds in config/healthcheck-typesense.php to adjust it.
Register the check
use IllumaLaw\HealthCheckTypesense\TypesenseCheck; use Spatie\Health\Facades\Health; Health::checks([ TypesenseCheck::new(), ]);
The check returns OK for a timely health response, Warning when it exceeds the threshold, and Failed when the request cannot reach Typesense.
Override settings
Pass client settings when they come from another config source, such as Scout:
TypesenseCheck::new() ->timeout(3) ->clientSettings([ 'api_key' => config('scout.typesense.api_key'), 'nodes' => [[ 'host' => config('scout.typesense.host'), 'port' => '8108', 'protocol' => 'http', ]], 'connection_timeout_seconds' => 2, ]);
If your application already has a Typesense\Client, pass it with
TypesenseCheck::new()->useClient($client).
Test
composer test
composer analyse
vendor/bin/pint --test
MIT licensed. See LICENSE.md.
