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