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

Method of the class: InstalledVersions{}

No Hooks.

Return

true|false.

Usage

$result = InstalledVersions::isInstalled( $packageName, $includeDevRequirements );
$packageName(string) (required)
-
$includeDevRequirements(true|false)
-
Default: true

InstalledVersions::isInstalled() code 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;
}