Composer

InstalledVersions::isInstalled()public staticWPSCache 1.0

Checks whether the given package is installed

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

Метод класса: InstalledVersions{}

Хуков нет.

Возвращает

true|false.

Использование

$result = InstalledVersions::isInstalled( $packageName, $includeDevRequirements );
$packageName(строка) (обязательный)
-
$includeDevRequirements(true|false)
-
По умолчанию: true

Код InstalledVersions::isInstalled() WPSCache 1.9.2

public static function isInstalled($packageName, $includeDevRequirements = true)
{
    foreach (self::getInstalled() as $installed) {
        if (isset($installed['versions'][$packageName])) {
            return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
        }
    }

    return false;
}