You are here

function composer_manager_installed_packages in Composer Manager 6.2

Same name and namespace in other branches
  1. 6 composer_manager.admin.inc \composer_manager_installed_packages()
  2. 7.2 composer_manager.admin.inc \composer_manager_installed_packages()
  3. 7 composer_manager.admin.inc \composer_manager_installed_packages()

Reads installed package versions from the composer.lock file.

NOTE: Tried using `composer show -i`, but it didn't return the versions or descriptions for some strange reason even though it does on the command line.

Return value

array An associative array of package version information.

Throws

\RuntimeException

2 calls to composer_manager_installed_packages()
composer_manager_packages_page in ./composer_manager.admin.inc
Page callback; Shows the status of all packages required by contrib.
composer_manager_packages_to_install in ./composer_manager.install
Returns a list of packages that need to be installed.

File

./composer_manager.admin.inc, line 309
Administrative settings for the Composer Manager module.

Code

function composer_manager_installed_packages() {
  $installed =& composer_manager_static(__FUNCTION__, NULL);
  if (NULL === $installed) {
    $installed = array();
    $json = composer_manager_installed_packages_load();
    foreach ($json as $package) {
      $installed[$package['name']] = array(
        'version' => $package['version'],
        'description' => !empty($package['description']) ? $package['description'] : '',
        'homepage' => !empty($package['homepage']) ? $package['homepage'] : '',
      );
    }
    ksort($installed);
  }
  return $installed;
}