Search by

illuma-law / healthcheck-typesense

miguelenes

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

Statistics

Installs: 64

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 1

v0.1.5 2026-10-23 13:49 UTC

README

Healthcheck Typesense banner

A Spatie Laravel Health check that calls Typesense’s /health endpoint and reports reachability and response time.

Tests Latest Version License

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.