### Compare Versions with Pre-release Labels Source: https://github.com/phar-io/version/blob/master/README.md Illustrates how to compare versions that include pre-release labels. It shows the usage of the Version class to determine the greater version between two versions with pre-release identifiers. ```php $leftVersion = new PharIo\Version\Version('3.0.0-alpha.1'); $rightVersion = new PharIo\Version\Version('3.0.0-alpha.2'); $leftVersion->isGreaterThan($rightVersion); // false $rightVersion->isGreaterThan($leftVersion); // true ``` -------------------------------- ### Parse and Comply with Version Constraints Source: https://github.com/phar-io/version/blob/master/README.md Demonstrates parsing version constraints using caret and tilde operators and checking if a given version complies with these constraints. It utilizes the VersionConstraintParser and Version classes. ```php use PharIo\Version\Version; use PharIo\Version\VersionConstraintParser; $parser = new VersionConstraintParser(); $caret_constraint = $parser->parse( '^7.0' ); $caret_constraint->complies( new Version( '7.0.17' ) ); // true $caret_constraint->complies( new Version( '7.1.0' ) ); // true $caret_constraint->complies( new Version( '6.4.34' ) ); // false $tilde_constraint = $parser->parse( '~1.1.0' ); $tilde_constraint->complies( new Version( '1.1.4' ) ); // true $tilde_constraint->complies( new Version( '1.2.0' ) ); // false ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.