Composer
InstalledVersions::satisfies()
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.
Return
true|false
.
Usage
$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() InstalledVersions::satisfies code WPSCache 1.12.4
public static function satisfies(VersionParser $parser, $packageName, $constraint) { $constraint = $parser->parseConstraints((string) $constraint); $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); return $provided->matches($constraint); }