How to verify whether the module is installed or not in Drupal 8/9

In Drupal 8/9, check if a module is installed by using the module_handler service.It allows you to programmatically check if a module is installed and enabled.

For example, if the devel module is installed then display "module already installed" otherwise programmatically installed devel module and display "Module installed successfully"
copy-icon

Comments

Authors

Read Next