Check if a Module is Enabled or Not

Need to check if a module is enabled or not? There are two ways in Magento 2 to do that!Let's check them!

The first way that you can easily do that is by using the command-line interface (CLI) of Magento 2 and specifically the following command from your Magento install dir.

php bin/magento module:status

The command above will output a list of enabled and disabled modules.

The second way is to do that programmaticaly. The class \Magento\Framework\Module\Manager provides us two function that do the check for us.

The function isEnabled(moduleName) which needs as a parameter the Module's name and returns whether a module is enabled in the configuration or not.

And the function isOutputEnabled($moduleName) which also needs a parameter the Module's name and returns whether a module output is permitted by the configuration or not.

Feel free to share this post and ask your questions in the comments below.

Till next time!