Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 19, 2024 via composer

composer/semver 3.4.0

Semver library that offers utilities, version constraint parsing and validation.
Package summary
Share
0
issues
1
license
1
MIT
Package created
17 Jul 2015
Version published
31 Aug 2023
Maintainers
3
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
composer/semver@3.4.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of composer/semver 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does composer/semver do?

The composer/semver is a Semantic Versioning (Semver) library that offers utilities for version constraint parsing and validation. It was originally a part of the composer/composer but is now a stand-alone library which developers can use independently. Utilizing composer/semver can prove useful for better versioning management in coding projects by providing efficient version comparison functions.

How do you use composer/semver?

composer/semver has a straightforward installation process. All you need is a PHP environment (version 5.3.2 and above recommended), and you can use the Composer dependency manager to install it with this command at your terminal: composer require composer/semver.

To make the best use of this package, here are some code examples for basic usage:

For comparing versions, you can utilize the Composer\Semver\Comparator class like this:

use Composer\Semver\Comparator;

Comparator::greaterThan('1.25.0', '1.24.0'); // Returns true if 1.25.0 > 1.24.0

The Semver class provides various methods like satisfies(), satisfiedBy(), sort(), rsort(), etc. which can be employed according to your requirements.

For dealing with complex constraints or reading version intervals from a constraint, the Composer\Semver\Intervals class has many useful methods:

use Composer\Semver\Intervals;

// Checks whether $candidate is a subset of $constraint
Intervals::isSubsetOf(ConstraintInterface $candidate, ConstraintInterface $constraint);

Where are the composer/semver docs?

For a deeper understanding of how versions are compared and how to make the most of composer/semver, referring to the official documentation can prove beneficial. You will find detailed usage guides and examples in the composer/semver repository on GitHub. For complete information on version comparison as per composer/semver, you can refer to the Versions article in the documentation section on the getcomposer.org website.