InstalledVersions::satisfies( ComposerSemverVersionParser $parser, string $packageName, string|null $constraint )
Checks whether the given package satisfies a version constraint
Description Description
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’)
Parameters Parameters
- $parser
-
(ComposerSemverVersionParser) (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
Return Return
(bool)
Source Source
File: libraries/lifterlms-cli/vendor/composer/InstalledVersions.php
public static function satisfies(VersionParser $parser, $packageName, $constraint) { $constraint = $parser->parseConstraints($constraint); $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); return $provided->matches($constraint); }
Expand full source code Collapse full source code View on GitHub