composer-semver
A faithful Rust port of composer/semver —
the Composer-flavored version normalization, comparison, and constraint algebra
that PHP's Composer itself uses.
use ;
let v = parse.unwrap;
let c = parse.unwrap;
assert!;
It mirrors Composer's VersionParser::normalize, Comparator::compare, and
VersionParser::parseConstraints against a pinned upstream commit (recorded in
src/version.rs), and the upstream data-provider cases are committed as Layer 1
conformance fixtures:
cargo test -p composer-semver
What's covered
Version— normalize (v1.2→1.2.0.0), branch versions (dev-*), stability detection, and Composer-correct comparison/ordering.Constraint—^,~,*/x, hyphen ranges,>=/</!=,||unions, stability flags, anddev-<branch>references;matches,lower_bound/upper_bound, andintersects.Stability—dev < alpha < beta < RC < stable.
Part of the composer-rs
workspace — shared Composer-domain crates for the cresset-tools family
(bougie,
sconce).
License
EUPL-1.2.