Home » Magento, Magento 228 March 2016

Magento 2: Check if a module is installed, enabled or active

This article shows how we can check if a module is installed / enabled or active in Magento 2.

Both Dependency Injection and Object Manager ways are shown below.

Using Dependency Injection (DI)

Below is a block class of my custom module (Chapagain_HelloWorld). I have injected object of \Magento\Framework\Module\Manager class in the constructor of my module’s block class.

app/code/Chapagain/HelloWorld/Block/HelloWorld.php

Now, we use these functions in our template (.phtml) file.

Using Object Manager

Hope this helps. Thanks.

Magento 2

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed