Skip to content

Expose the modules on the actuator

At the end, GET /actuator/modules returns every module (enabled and disabled) as JSON. External tools and dashboards can inspect module status over HTTP without shell access.

When nwidart/laravel-actuator ^1.1 is installed, Laravel Modules registers the modules endpoint automatically. Earlier versions (1.0.0) do not support custom endpoints and return 404.

  1. Install the actuator.

    Terminal window
    composer require nwidart/laravel-actuator
  2. Publish its configuration.

    Terminal window
    php artisan vendor:publish --tag=actuator-config
  3. Add modules to exposure.include in config/actuator.php.

    config/actuator.php
    'exposure' => [
    'include' => ['health', 'modules'],
    'exclude' => [],
    ],

    By default, the actuator exposes health only. Setting include to ['*'] exposes modules alongside all other actuator endpoints, and exclude always wins.

    modules.actuator.enabled in config/modules.php does not control this endpoint. It controls health indicators only; see Report module health with the actuator.

Terminal window
curl -H 'Accept: application/json' http://127.0.0.1:8000/actuator/modules

The response includes the installed package version and every module sorted case-insensitively by name:

{
"package": { "name": "nwidart/laravel-modules", "version": "v13.3.0" },
"modules": [
{ "name": "Blog", "enabled": true, "version": "1.2.0", "description": "Blog posts", "priority": 0, "providers": ["Modules\\Blog\\Providers\\BlogServiceProvider"] },
{ "name": "Shop", "enabled": false, "version": null, "description": "", "priority": 10, "providers": ["Modules\\Shop\\Providers\\ShopServiceProvider"] }
]
}

Each module exposes only name, enabled, version, description, priority, and providers. It never exposes filesystem paths, files, custom module.json keys, composer.json, or package configuration. See Actuator integration for the exact schema and defaults.

Terminal window
curl -H 'Accept: application/json' http://127.0.0.1:8000/actuator/modules/shop
{ "name": "Shop", "enabled": false, "version": null, "description": "", "priority": 10, "providers": ["Modules\\Shop\\Providers\\ShopServiceProvider"] }

Name lookup matches Module::find() (case-insensitive, accepting kebab-case or snake_case). An unknown module returns 404. The endpoint is read-only.

actuator.middleware applies to every actuator route. To protect only the modules endpoint, add a modules.middleware block to config/actuator.php:

config/actuator.php
'modules' => [
'middleware' => ['auth.basic'],
],

With auth.basic, /actuator/modules returns 401 without credentials while /actuator/health stays public.

The endpoint works with php artisan config:cache and php artisan route:cache. Status changes appear on the next request with no cache to clear.

Terminal window
php artisan route:list --path=actuator

The output lists actuator/modules and actuator/modules/{name}. If they are missing, verify modules is in exposure.include and nwidart/laravel-actuator is 1.1.0 or later.