Skip to content

Loom Modules 🧩

Loom is modular by design.
Each module is a self-contained feature that can be enabled, disabled, or customized without affecting the rest of the application.


A module is a package of features that can include:

  • Routes
  • Controllers
  • Policies
  • Views / Components
  • Migrations / Seeders
  • Config files
  • Event listeners / Notifications

Modules allow you to pick only what you need for your application.


Loom uses Laravel Pennant for feature flags.

Enable or disable a module in config/loom.php:

return [
'modules' => [
'blog' => true,
'shop' => false,
'newsletter' => true,
],
];

Or programmatically:

use Laravel\Pennant\Feature;
if (Feature::active('blog')) {
// Module code will run
}

Use the CLI to add a module:

Terminal window
php artisan loom:add blog
  • Publishes routes, controllers, views, and seeders
  • Automatically enables the module if feature flag is active
  • Updates module list (loom:list)

Disable a module via feature flag:

Feature::off('shop');

Remove a module entirely (optional):

Terminal window
php artisan loom:remove shop
  • Removes routes, controllers, and views
  • Leaves database tables if needed (can run loom:reset for full cleanup)

A typical module has the following layout:

Modules/
β”œβ”€ Blog/
β”‚ β”œβ”€ Http/
β”‚ β”‚ └─ Controllers/
β”‚ β”œβ”€ Models/
β”‚ β”œβ”€ Views/
β”‚ β”œβ”€ database/
β”‚ β”‚ β”œβ”€ migrations/
β”‚ β”‚ └─ seeders/
β”‚ └─ config.php
└─ Shop/
└─ ...
  • Http/Controllers β†’ module routes and business logic
  • Models β†’ module-specific models
  • Views β†’ Livewire components / Blade templates
  • Database β†’ migrations & seeders
  • Config β†’ module-specific configuration

You can:

  • Override resources (Models, Policies, Views)
  • Add your own seeders or migrations
  • Create custom commands for the module
  • Trigger events / notifications from the module

  • Add your first module β†’ /tutorials/add-blog-module/
  • Learn about Core architecture β†’ /guides/core-package/
  • Check CLI commands β†’ /reference/commands/