Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. InstalledVersions.php

function InstalledVersions::isInstalled

Same name in this branch
  1. 11.1.x vendor/composer/composer/src/Composer/InstalledVersions.php \Composer\InstalledVersions::isInstalled()

Checks whether the given package is installed

This also returns true if the package name is provided or replaced by another package

Parameters

string $packageName:

bool $includeDevRequirements:

Return value

bool

3 calls to InstalledVersions::isInstalled()
ContainerBuilder::willBeAvailable in vendor/symfony/dependency-injection/ContainerBuilder.php
Checks whether a class is available and will remain available in the "no-dev" mode of Composer.
PackageDependency::isSatisfied in vendor/tbachert/spi/src/ServiceProviderDependency/PackageDependency.php
Returns whether this requirement is satisfied.
Sdk::getResource in vendor/open-telemetry/sdk/Resource/Detectors/Sdk.php

File

vendor/composer/InstalledVersions.php, line 102

Class

InstalledVersions
This class is copied in every Composer installed project and available to all

Namespace

Composer

Code

public static function isInstalled($packageName, $includeDevRequirements = true) {
    foreach (self::getInstalled() as $installed) {
        if (isset($installed['versions'][$packageName])) {
            return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
        }
    }
    return false;
}
RSS feed
Powered by Drupal