How can I get, code wise, the list of the installed modules and their version listed in composer?
I need something like this (format is just as an example. It's not really important):
array(
array(
'name' => 'magento/module-catalog',
'version' => '101.1.0'
),
array(
'name' => 'magento/module-cms',
'version' => '101.1.0'
),
....
)
I tried \Magento\Framework\Composer\ComposerInformation::getInstalledMagentoPackages()
and getSystemPackages()
, but both return and empty array.
I suspect this might happen because I didn't install Magento 2 via composer. I just cloned the guthub repo.
But this is not a solution. I need something that will work on both install methods (composers and clone repo).