Anvyr Docs
Documentation menu Anvyr Loom 1.x
Anvyr Loom

Version 1.x

← All documentation

GuideAnvyr Loom 1.xDeveloper

Build with modules

Scaffold a module, inspect its manifest, and enable it explicitly.

On this page

Scaffold a module

From your application root:

php loom make:module Notes
php loom module:list

Inspect the generated files under user/modules/Notes. A module is an application unit with an entry class and a manifest, rather than an implicit collection of globally loaded files.

Inspect the manifest

module.json describes the module name, version, entry class, dependencies, and integrations. Optional declarations include routes, views, and commands.

{
    "name": "notes",
    "version": "0.1.0",
    "entry": "Notes\\Module",
    "routes": {
        "web": "routes/web.php"
    },
    "views": "resources/views"
}

This fragment illustrates the declaration fields. Keep the generated autoload configuration and entry class, and create declared files before enabling the module. Dependency constraints use semantic versions; the module manager resolves dependency order.

Register and boot

An entry class can extend Anvyr\Loom\Core\BaseModule.

  • register(Application $app) declares service bindings and integrations.
  • boot(Application $app) performs work after registration.
  • path() resolves a path relative to the module directory.
  • loadViewsFrom() registers a view namespace.

Keep construction and side effects separate. A module that needs another module should declare that relationship rather than depending on accidental load order.

Enable the module

php loom module:enable notes
php loom module:info notes

Use the manifest's module name, which may differ in case from the folder name. Enabling validates the discovered module and updates module state and generated artifacts. Tenant-aware applications can enable modules in a particular context using --tenant.

Continue with routes and middleware or service bindings.

Continue readingValidate input