7

I am installing a few modules one by one into my magento 2 application. Can we enable all modules in the same namespace with one command?

Right now I am using:

php bin/magento module:enable Vendor_MyModule1
php bin/magento module:enable Vendor_MyModule2
php bin/magento module:enable Vendor_MyModule3

Is there a way I can do this with a wildcard?

php bin/magento module:enable Vendor_*
10

You cannot use wildcards but you can enable all of them from one command like this:

php bin/magento module:enable Vendor_MyModule1 Vendor_MyModule2 Vendor_MyModule3
| improve this answer | |
  • this is definitely an improvement – Xenocide8998 Jun 23 '16 at 13:41
6

You can use the the --all flag to enable all available modules

 php bin/magento module:enable --all

This of course is if you don't mind enabling all modules. Tested in magento 2.1.x

| improve this answer | |
  • Might be the way to go ... if you want to enable "most" then you can exec this ... then run Disable whta you dont need before you hit upgrade – snh_nl Apr 23 '19 at 11:56
5

Short answer: Yes, you can.

But it is *nix command trick, Magento 2 does not support it by default as Marius answer.

You can execute the following command and it can do what you want.

php bin/magento module:status | grep VendorName_ | grep -v List | grep -v None | grep -v -e '^$'| xargs php bin/magento module:enable

Cheers.

| improve this answer | |
0

In case you have copied an entire namespace directory(ies) and want Magento to install all those at one shot then do the following :

php bin/magento setup:upgrade

This way you don't have to mention all modules names.

| improve this answer | |
  • This is just perfect if you want to install magento with a lot of custom modules on a empty database. _<sequence> _ is just so bad with that... – Pol Ravalitera Sep 6 '17 at 13:56
  • php bin/magento setup:upgrade this won't enable any previously disabled module. setup:upgrade is required after placing extensions dir. So first the extension has to be in app/code/ and then enabling these extensions by module:enable then lastly running module:enable – Mohammed Joraid Jul 24 '18 at 16:10
0

Another way would be:

  • Open app/etc/config.php
  • That file returns an array of modules with the module name as key and 1 or 0 as value.
    • 1 indicates enabled
    • 0 indicates disabled
  • You can find the modules that you want to disable and set their respective value to 0.
  • Here's an example:

    <?php
    return [
        'modules' => [
            ...
            ...
            'Vendor_MyModule1' => 0,
            'Vendor_MyModule2' => 0,
            'Vendor_MyModule3' => 0,
            ...
            ...
    
  • After that, open terminal and go to your magento root directory.

    cd /path/to/your/magento/root/folder
    
  • Finally, run setup upgrade command:

    php bin/magento setup:upgrade
    
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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