I tried below code which gives me all modules name not specifying the status whether it is enable or disable.
__construct
public function __construct(
\Magento\Framework\Module\ModuleList $moduleList
) {
$this->moduleList = $moduleList;
}
and here's the list
$modules = $this->moduleList->getAll();
Any idea to get module names with it's status ?