Skip to content

Remove Module Command

The mm:remove-module command is used to remove an installed module from your application.

Usage

bash
php artisan mm:remove-module [module]

Arguments

ArgumentDescription
module(Optional) The name of the module to remove

Description

This command safely removes a module from your application, handling all necessary cleanup tasks including permission removal, migration rollbacks, and composer package removal.

When executed, this command performs the following actions:

  1. Select Module: If no module is specified, it asks you to provide the name of the module to remove.

  2. Remove Permissions: Automatically removes all permissions associated with the module's models.

  3. Optional Migration Rollback: Asks if you want to roll back the module's migrations and performs the rollback if confirmed.

  4. Remove Composer Package: Removes the module's composer package from your dependencies.

  5. Clean Up Repository Configuration: Removes any repository configuration related to the module from your composer.json file.

  6. Disable Module: Disables the module in the Laravel Modules system.

Examples

Interactive Mode

bash
$ php artisan mm:remove-module
What is the name of the module? Blog
Removing permissions associated with the module...
Removed 30 permissions associated with module Blog.

Do you want to run the migrations rollback? (y/n) [y]
Running migrations rollback...
Migrations rollback completed.

Removing module...
Removing module via Composer...
Module removed successfully.

With Module Argument

bash
$ php artisan mm:remove-module Blog
Removing permissions associated with the module...
Removed 30 permissions associated with module Blog.

Do you want to run the migrations rollback? (y/n) [y]
Running migrations rollback...
Migrations rollback completed.

Removing module...
Removing module via Composer...
Module removed successfully.

Permission Handling

The command automatically removes all permissions that were generated for the module's models. This ensures that no orphaned permissions remain in your database after removing the module.

Notes

  • This command requires a valid API key for the Module Manager registry.
  • The removal process is thorough and removes all traces of the module from your application.
  • Any custom code or modifications made to the module will be lost when it's removed.
  • Database tables created by the module's migrations will be dropped if you choose to run the migration rollback.