Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Modular Laravel Package

alizharb/laravel-modular

View on GitHub
Deep Wiki
Context7

Artisan Commands

Generator Commands (The Daily Drivers)

These commands create files inside your modules. They support all standard Laravel flags (like -m, -c, -r).

[!TIP] Custom Per-Module Stubs (v1.1.5+) The make:* commands will automatically scan inside your module for a stubs/ directory first before falling back to application stubs. This allows you to completely override Laravel's generator scaffolding exclusively for one specific module! (e.g., modules/Shop/stubs/controller.model.stub)

make:module

Creates a brand new module with the full directory structure.

php artisan make:module Shop

What it does:

  1. Creates the directory structure (App, Database, Resources, etc).
  2. Generates initial files: module.json, composer.json, package.json, vite.config.js.
  3. New in v1.1.4: Automatically generates .gitignore and .gitattributes.
  4. Creates ShopServiceProvider.
  5. Updates composer.json autoloading (PSR-4).
  6. New in v1.1.4: Automatically clears modular cache and optionally links assets (see Configuration).

make:model

Creates an Eloquent model.

php artisan make:model Product --module=Shop

Options:

  • -m, --migration: Create a migration file.
  • -c, --controller: Create a controller.
  • -r, --resource: Controller should be a Resource Controller.
  • -f, --factory: Create a factory.
  • -s, --seed: Create a seeder.
  • --policy: Create a policy.
  • -a, --all: Do EVERYTHING (migration, factory, seeder, policy, controller, resource).

Example:

# Create Model + Migration + Factory + Resource Controller
php artisan make:model Order --module=Shop -mfr

make:controller

Creates a controller class.

php artisan make:controller ProductController --module=Shop

Options:

  • --resource: Generate a resource controller (index, create, store...).
  • --api: Generate an API controller (no create/edit methods).
  • --model=Product: Bind the controller to a model.

make:migration

Creates a database migration.

php artisan make:migration create_orders_table --module=Shop

File Location:

Creates modules/Shop/database/migrations/xxxx_xx_xx_create_orders_table.php.


Other Generators

All of these work exactly as you expect, just add --module=Name.

  • make:command (Console Command)
  • make:component (Blade Component)
  • make:event
  • make:factory
  • make:job
  • make:listener
  • make:mail
  • make:middleware
  • make:notification
  • make:observer
  • make:policy
  • make:provider
  • make:request (Form Request)
  • make:resource (API Resource)
  • make:rule
  • make:seeder
  • make:test

Management Commands (modular:*)

commands to manage the lifecycle and state of your modules.

modular:list

Displays a table of all modules, their status (Enabled/Disabled), and path.

php artisan modular:list

# Visualize dependencies in an ASCII tree!
php artisan modular:list --tree

modular:migrate

Migrate the database.

# Migrate ALL enabled modules + core app
php artisan modular:migrate

# Migrate ONLY the Shop module
php artisan modular:migrate Shop

# Rollback migrations for ONLY the Shop module
php artisan modular:migrate Shop --rollback

# Rollback exactly 2 steps for the Shop module
php artisan modular:migrate Shop --rollback --step=2

modular:seed

Run database seeders.

# Seed 'Shop' module (looks for Shop\Database\Seeders\ShopSeeder)
php artisan modular:seed Shop

modular:test

Run PHPUnit/Pest tests with isolation.

php artisan modular:test Shop

# Run tests with unified coverage (requires phpunit/phpcov)
php artisan modular:test --coverage-html=coverage-report

Coverage Options:

  • --coverage: Enable coverage collection.
  • --coverage-clover={path}: Export Clover XML.
  • --coverage-html={path}: Export HTML report.

Note: Individual module coverage is collected in isolation and merged into a single report.


modular:npm

Run NPM commands inside a module's directory.

# Install a package for Shop
php artisan modular:npm Shop install chart.js

# Build assets for Shop
php artisan modular:npm Shop run build

modular:sync

This command is critical for large teams. It scans all packages/modular/*/composer.json files and merges their requirements into the root composer.json (into a requires section managed by the package).

Note: This usually happens automatically during make:module, but run this if you manually edit dependencies.

php artisan modular:sync

modular:check

Checks for circular dependencies between modules.

php artisan modular:check

modular:link

Symlinks module public assets to the public/ directory.

php artisan modular:link

modular:cache

Create a cache file for faster module discovery. Checks for config, views, translations, and migrations.

php artisan modular:cache

modular:clear

Remove the modular discovery cache file.

php artisan modular:clear

modular:debug

Debug module configuration, providers, and middleware.

# Debug all modules summary
php artisan modular:debug

# Debug a specific module (deep dive)
php artisan modular:debug Shop

modular:ide-helper

Generate a helper file (_ide_helper_modular.php) to help IDEs auto-complete module names.

php artisan modular:ide-helper

modular:doctor

Diagnose common configuration issues and architectural integrity.

php artisan modular:doctor

What it checks:

  • Autoloading: Verifies PSR-4 registration in composer.json.
  • Circular Dependencies: Integrates modular:check logic.
  • Metadata: Validates module.json and basic directory structure.
  • Ghost Modules: Detects directories in the modules path that are missing a module.json.
  • Duplicate Providers: Identifies if the same Service Provider is registered in multiple modules.
  • Asset Linking: Verifies that the required public/modules directory exists.

modular:publish

Publish configuration and stub files for customization.

php artisan modular:publish
  • Select config to publish config/modular.php.
  • Select stubs to publish generator stubs.

module:enable

Enable a module instantly.

php artisan module:enable Shop

Note: Enabled modules are verified for dependencies. If a module requires another module that is currently disabled, the command will fail.


module:disable

Disable a module instantly.

php artisan module:disable Shop

Disabled modules are not loaded, their routes are 404, and their services are not booted.


module:uninstall

Uninstall (delete) a module.

# Uninstall the Shop module
php artisan module:uninstall Shop

# Force uninstall in production
php artisan module:uninstall Shop --force
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nasirkhan/laravel-sharekit
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony