{"id":13548915,"url":"https://github.com/composer/semver","last_synced_at":"2025-05-12T13:26:13.277Z","repository":{"id":35034739,"uuid":"39149689","full_name":"composer/semver","owner":"composer","description":"Semantic versioning utilities with the addition of version constraints parsing and checking.","archived":false,"fork":false,"pushed_at":"2024-09-19T14:15:31.000Z","size":622,"stargazers_count":3212,"open_issues_count":4,"forks_count":74,"subscribers_count":15,"default_branch":"main","last_synced_at":"2025-05-03T01:55:29.876Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"conda-forge/matplotlib-feedstock","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/composer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":"https://packagist.com","tidelift":"packagist/composer/composer","github":"composer"}},"created_at":"2015-07-15T17:05:25.000Z","updated_at":"2025-04-30T19:22:14.000Z","dependencies_parsed_at":"2024-06-18T10:37:44.783Z","dependency_job_id":"401e4f5c-a8f4-4d64-a93d-d719d6461558","html_url":"https://github.com/composer/semver","commit_stats":{"total_commits":441,"total_committers":56,"mean_commits":7.875,"dds":0.4852607709750567,"last_synced_commit":"4313d26ada5e0c4edfbd1dc481a92ff7bff91f12"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/composer%2Fsemver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/composer%2Fsemver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/composer%2Fsemver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/composer%2Fsemver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/composer","download_url":"https://codeload.github.com/composer/semver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253746604,"owners_count":21957597,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T12:01:15.947Z","updated_at":"2025-05-12T13:26:13.214Z","avatar_url":"https://github.com/composer.png","language":"PHP","funding_links":["https://packagist.com","https://tidelift.com/funding/github/packagist/composer/composer","https://github.com/sponsors/composer"],"categories":["PHP","类库"],"sub_categories":["未归类"],"readme":"composer/semver\n===============\n\nSemver (Semantic Versioning) library that offers utilities, version constraint parsing and validation.\n\nOriginally written as part of [composer/composer](https://github.com/composer/composer),\nnow extracted and made available as a stand-alone library.\n\n[![Continuous Integration](https://github.com/composer/semver/actions/workflows/continuous-integration.yml/badge.svg?branch=main)](https://github.com/composer/semver/actions/workflows/continuous-integration.yml)\n[![PHP Lint](https://github.com/composer/semver/actions/workflows/lint.yml/badge.svg?branch=main)](https://github.com/composer/semver/actions/workflows/lint.yml)\n[![PHPStan](https://github.com/composer/semver/actions/workflows/phpstan.yml/badge.svg?branch=main)](https://github.com/composer/semver/actions/workflows/phpstan.yml)\n\nInstallation\n------------\n\nInstall the latest version with:\n\n```bash\ncomposer require composer/semver\n```\n\n\nRequirements\n------------\n\n* PHP 5.3.2 is required but using the latest version of PHP is highly recommended.\n\n\nVersion Comparison\n------------------\n\nFor details on how versions are compared, refer to the [Versions](https://getcomposer.org/doc/articles/versions.md)\narticle in the documentation section of the [getcomposer.org](https://getcomposer.org) website.\n\n\nBasic usage\n-----------\n\n### Comparator\n\nThe [`Composer\\Semver\\Comparator`](https://github.com/composer/semver/blob/main/src/Comparator.php) class provides the following methods for comparing versions:\n\n* greaterThan($v1, $v2)\n* greaterThanOrEqualTo($v1, $v2)\n* lessThan($v1, $v2)\n* lessThanOrEqualTo($v1, $v2)\n* equalTo($v1, $v2)\n* notEqualTo($v1, $v2)\n\nEach function takes two version strings as arguments and returns a boolean. For example:\n\n```php\nuse Composer\\Semver\\Comparator;\n\nComparator::greaterThan('1.25.0', '1.24.0'); // 1.25.0 \u003e 1.24.0\n```\n\n### Semver\n\nThe [`Composer\\Semver\\Semver`](https://github.com/composer/semver/blob/main/src/Semver.php) class provides the following methods:\n\n* satisfies($version, $constraints)\n* satisfiedBy(array $versions, $constraint)\n* sort($versions)\n* rsort($versions)\n\n### Intervals\n\nThe [`Composer\\Semver\\Intervals`](https://github.com/composer/semver/blob/main/src/Intervals.php) static class provides\na few utilities to work with complex constraints or read version intervals from a constraint:\n\n```php\nuse Composer\\Semver\\Intervals;\n\n// Checks whether $candidate is a subset of $constraint\nIntervals::isSubsetOf(ConstraintInterface $candidate, ConstraintInterface $constraint);\n\n// Checks whether $a and $b have any intersection, equivalent to $a-\u003ematches($b)\nIntervals::haveIntersections(ConstraintInterface $a, ConstraintInterface $b);\n\n// Optimizes a complex multi constraint by merging all intervals down to the smallest\n// possible multi constraint. The drawbacks are this is not very fast, and the resulting\n// multi constraint will have no human readable prettyConstraint configured on it\nIntervals::compactConstraint(ConstraintInterface $constraint);\n\n// Creates an array of numeric intervals and branch constraints representing a given constraint\nIntervals::get(ConstraintInterface $constraint);\n\n// Clears the memoization cache when you are done processing constraints\nIntervals::clear()\n```\n\nSee the class docblocks for more details.\n\n\nLicense\n-------\n\ncomposer/semver is licensed under the MIT License, see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomposer%2Fsemver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcomposer%2Fsemver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomposer%2Fsemver/lists"}