Skip to content

Configuration

Data Health works with its defaults immediately; publish configuration when the application needs different discovery paths, generated finding interfaces, scheduler behavior, cleanup behavior, or Filament presentation.

Publish the core configuration file with:

Terminal window
php artisan vendor:publish --tag=data-health-config

This creates config/data-health.php. To publish both configuration and migrations at once, use the package-wide tag:

Terminal window
php artisan vendor:publish --tag=data-health

Published files belong to the application and are not overwritten by package updates. Compare them with new package defaults when upgrading.

The default configuration is:

use DataHealth\Contracts\CanDetect;
return [
'scheduler' => [
'enabled' => env('DATA_HEALTH_SCHEDULER_ENABLED', true),
],
'auto_delete' => [
'enabled' => env('DATA_HEALTH_AUTO_DELETE_ENABLED', false),
],
'directories' => [
'app/DataHealth' => 'App\\DataHealth\\',
],
'make_finding' => [
'interfaces' => [CanDetect::class],
],
];
Configuration key Default Purpose
data-health.directories ['app/DataHealth' => 'App\\DataHealth\\'] Maps directories to namespaces for finding discovery.
data-health.make_finding.interfaces [DataHealth\Contracts\CanDetect::class] Interfaces and method placeholders included in newly generated finding classes.
data-health.scheduler.enabled true Registers findings carrying Scheduled with Laravel’s scheduler.
data-health.auto_delete.enabled false Deletes finding records when their related model is deleted.

Each entry in directories maps a path relative to the application base path to its root namespace:

'directories' => [
'app/DataHealth' => 'App\\DataHealth\\',
'app/Domain/Billing/Findings' => 'App\\Domain\\Billing\\Findings\\',
],

The namespace may include or omit its trailing backslash because Data Health normalizes it before appending the relative class name. The namespace below it must mirror the directory structure, and only concrete subclasses of DataHealth\Finding are registered.

See Finding Discovery for the complete discovery rules.

health:make:finding includes CanDetect and a detect() placeholder by default. Set make_finding.interfaces to choose any combination of the four supported interfaces:

'make_finding' => [
'interfaces' => [
\DataHealth\Contracts\CanDetect::class,
\DataHealth\Contracts\CanVerify::class,
\DataHealth\Contracts\CanResolve::class,
\DataHealth\Contracts\CanExplain::class,
],
],

Use [] to generate findings without default capability interfaces or methods. Unsupported interfaces are rejected before a file is written. This setting affects future generation; existing classes remain as they are.

Command options add capabilities to the configured defaults without duplicating interfaces or methods. --schedule always adds detection, --auto-verify adds verification, and --auto-resolve adds resolution. See Generating Finding Classes for all generator options.

Scheduled finding registration is enabled by default:

DATA_HEALTH_SCHEDULER_ENABLED=true

Set it to false when another process is responsible for running detection or when a deployment must not register Data Health events:

DATA_HEALTH_SCHEDULER_ENABLED=false

This option affects only automatic schedule registration. The health:detect command (with or without --async), direct calls to a finding’s detect() method, custom jobs, and detection initiated through Filament remain available.

Automatic cleanup is disabled by default:

DATA_HEALTH_AUTO_DELETE_ENABLED=false

Enable it to delete a model’s finding records when that model is deleted:

DATA_HEALTH_AUTO_DELETE_ENABLED=true

The setting is global. Keep it disabled if findings must remain as an audit trail, and remember that restoring a soft-deleted model does not recreate deleted findings. See Model Cleanup for lifecycle details.

Use Laravel’s config() helper with the package keys:

$directories = config('data-health.directories');
$findingInterfaces = config('data-health.make_finding.interfaces');
$schedulerEnabled = config('data-health.scheduler.enabled');
$autoDeleteEnabled = config('data-health.auto_delete.enabled');

Tests may override a value before the package behavior is exercised:

config()->set('data-health.scheduler.enabled', false);

Scheduler registration and discovery happen while the application boots, so changing those values after boot is too late for the current process.

After changing environment variables or published configuration in an application that caches configuration, rebuild the cache:

Terminal window
php artisan config:cache

Restart long-running queue workers and scheduler processes so they load the new values. Use class names rather than closures in configuration because closures cannot be serialized by config:cache.

Environment Suggested settings
Local development Keep scheduling enabled only when using schedule:work; use a synchronous queue for simple debugging.
Test suite Disable scheduling unless a test specifically covers registration; set other values explicitly in the test.
Single-server production Enable scheduling when Laravel’s scheduler is operated; choose cleanup according to retention requirements.
Multi-server production Enable scheduling on scheduler hosts and use a shared lock-capable cache for overlap and one-server locks.

These are operational starting points, not package requirements. The scheduler, queue workers, and shared cache are provided and operated by the Laravel application.

The optional Filament integration uses a separate file. Publish it with:

Terminal window
php artisan vendor:publish --tag=data-health-filament-config
Configuration key Default Purpose
data-health-filament.navigation_group 'Data Health' Navigation group containing the package resources.
data-health-filament.navigation_sort 100 Base navigation sort position.
data-health-filament.polling_interval null Filament-compatible statistics refresh interval, such as '10s'; null disables polling.
data-health-filament.assignee_types null Invokable class returning allowed MorphToSelect\Type definitions.
data-health-filament.model_view_routes [] Maps affected model classes or morph types to named routes.
data-health-filament.model_view_url_resolver null Invokable class that returns a model URL or null.

These values apply to all panels and standalone package components. See Configuration and Model Links for examples and URL-resolution precedence.