InstalledVersions::satisfies()public staticWPSCache 1.0

Checks whether the given package satisfies a version constraint

e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:

Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')

Method of the class: InstalledVersions{}

No Hooks.




$result = InstalledVersions::satisfies( $parser, $packageName, $constraint );
$parser(VersionParser) (required)
Install composer/semver to have access to this class and functionality
$packageName(string) (required)
$constraint(string|null) (required)
A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package

InstalledVersions::satisfies() code WPSCache 1.9.2

public static function satisfies(VersionParser $parser, $packageName, $constraint)
    $constraint = $parser->parseConstraints($constraint);
    $provided = $parser->parseConstraints(self::getVersionRanges($packageName));

    return $provided->matches($constraint);