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
    Feb 15 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
    Feb 15 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
    Feb 17 at 6:34
  • Yes, but from there you get idea, for your requirement what you want to do. Feb 17 at 9:24

Your Answer

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

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