I want override command module:uninstall <module_name>. while execute this php bin/magento module:uninstall <module_name> also in relevant command disable,enable,status

i want to execute my custom module code. can i do? please guide me on this.

Note: i'm try to use in magento 2.4.5-p1

  • 1
    why you donot create another custom command for your requirement?
    – Amit Bera
    Commented Feb 15, 2023 at 7:57
  • @Amit Bera NO i can create but my requirement is when this command module:uninstall execute then i want execute my custom requirement.
    – Vivek
    Commented Feb 15, 2023 at 9:00

1 Answer 1


Here are the file which called on particular command.


/magento root/vendor/magento/magento2-base/setup/src/Magento/Setup/Console/Command/ModuleDisableCommand.php - execute method there


/magento root/vendor/magento/magento2-base/setup/src/Magento/Setup/Console/Command/ModuleStatusCommand.php - execute method there


/magento root/vendor/magento/magento2-base/setup/src/Magento/Setup/Console/Command/ModuleDisableCommand.php


/magento root/vendor/magento/magento2-base/setup/src/Magento/Setup/Console/Command/ModuleEnableCommand.php

  • i know this path. it's not my issue as i mention in my question.
    – Vivek
    Commented Feb 17, 2023 at 6:34
  • Yes, but from there you get idea, for your requirement what you want to do. Commented Feb 17, 2023 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.