Report module health with the actuator
At the end, /actuator/health reports which modules are enabled and returns DOWN if an enabled module is missing from disk. Modules can also register their own health checks on the same endpoint.
This integration uses nwidart/laravel-actuator (^1.1), which is optional. For endpoint setup and show_details options, see the Laravel Actuator documentation.
Install the actuator
Section titled “Install the actuator”composer require nwidart/laravel-actuatorOnce installed, Laravel Modules registers a modules health indicator automatically. No configuration edit is required.
The modules indicator
Section titled “The modules indicator”When show_details allows it (for example ACTUATOR_HEALTH_SHOW_DETAILS=always), the modules indicator lists each module and its enabled status:
{ "modules": { "Blog": { "enabled": true }, "Shop": { "enabled": false } }}The indicator reports UP when every enabled module has its module.json on disk. It reports DOWN (HTTP 503) when an enabled module is missing from disk, and attaches an error to that module’s entry. To resolve a DOWN status, restore the module folder, remove its entry from modules_statuses.json, or set it to false.
See Actuator integration for full indicator behavior, including long-lived processes and custom activators.
Ship a health indicator from a module
Section titled “Ship a health indicator from a module”-
Generate the health indicator class.
Terminal window php artisan module:make-health-indicator PaymentsHealthIndicator BlogThis creates
Modules/Blog/app/Health/PaymentsHealthIndicator.php. -
Implement
health()to return aHealthstatus (Health::up(),Health::down(),Health::outOfService(), orHealth::unknown()). Any thrown exception is reported asDOWN.Modules/Blog/app/Health/PaymentsHealthIndicator.php <?phpnamespace Modules\Blog\Health;use Nwidart\Actuator\Health\Health;use Nwidart\Actuator\Health\HealthIndicator;class PaymentsHealthIndicator implements HealthIndicator{public function health(): Health{return Health::up(['provider' => 'reachable']);}} -
Register the indicator in the
$healthIndicatorsproperty of your module service provider (extendingModuleServiceProvider).Modules/Blog/app/Providers/BlogServiceProvider.php protected array $healthIndicators = ['payments' => \Modules\Blog\Health\PaymentsHealthIndicator::class,'queue' => [\Modules\Blog\Health\QueueHealthIndicator::class, ['connection' => 'blog']],];
Each entry is either a class name or [class, [constructor arguments]], resolved through the container. The package registers each indicator as module:{lowercase module name}:{key} (for example module:blog:payments and module:blog:queue).
- Disabled modules register no indicators.
- An indicator with the same name in
config/actuator.phptakes precedence. - Without
nwidart/laravel-actuatorinstalled,$healthIndicatorsis ignored.
Turn health indicators off
Section titled “Turn health indicators off”Set modules.actuator.enabled to false in config/modules.php to disable both the modules indicator and all module $healthIndicators:
'actuator' => [ 'enabled' => false,],This affects health indicators only. The modules actuator endpoint stays registered; see Expose the modules on the actuator.
Cached configuration
Section titled “Cached configuration”Health indicators register during boot, so php artisan config:cache snapshots them. Re-run php artisan config:cache after enabling or disabling a module, changing $healthIndicators, or toggling modules.actuator.enabled.
Limits
Section titled “Limits”- An invalid
module.jsonor unloadable module service provider halts application boot with HTTP 500 before/actuator/healthcan run. Monitor your application’s HTTP status separately. - A nonexistent class in
$healthIndicatorscauses/actuator/healthto fail with HTTP 500 (BindingResolutionException). Verify class names after registering them.
Check the result
Section titled “Check the result”Request the health endpoint (with ACTUATOR_HEALTH_SHOW_DETAILS=always in local development):
curl -H 'Accept: application/json' http://127.0.0.1:8000/actuator/healthThe JSON response includes the modules component and any module:blog:* components you registered. You can also query one component directly at /actuator/health/module:blog:payments.