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’)


Top ↑

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


Top ↑

Return Return

(bool)


Top ↑

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);
    }

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.