{"id":15984581,"url":"https://github.com/rollerworks/version","last_synced_at":"2025-03-16T07:32:00.087Z","repository":{"id":52616097,"uuid":"85467048","full_name":"rollerworks/version","owner":"rollerworks","description":"Semantic Versioning helper library. Validation, incrementing (get next possible version(s)).","archived":false,"fork":false,"pushed_at":"2024-04-29T19:28:56.000Z","size":46,"stargazers_count":8,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-27T05:49:30.787Z","etag":null,"topics":["php","rollerworks","semver","validation","version"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rollerworks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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}},"created_at":"2017-03-19T10:17:41.000Z","updated_at":"2024-04-29T19:28:26.000Z","dependencies_parsed_at":"2024-10-27T10:11:01.604Z","dependency_job_id":"8f9655e3-73bd-47e7-a43d-9c91865d0cb0","html_url":"https://github.com/rollerworks/version","commit_stats":{"total_commits":17,"total_committers":2,"mean_commits":8.5,"dds":"0.17647058823529416","last_synced_commit":"8cff16f5fbdcf0fdf53a90fa459cf1cb99b3e2d1"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollerworks%2Fversion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollerworks%2Fversion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollerworks%2Fversion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollerworks%2Fversion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rollerworks","download_url":"https://codeload.github.com/rollerworks/version/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243806045,"owners_count":20350775,"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":["php","rollerworks","semver","validation","version"],"created_at":"2024-10-08T02:09:41.881Z","updated_at":"2025-03-16T07:31:59.729Z","avatar_url":"https://github.com/rollerworks.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Rollerworks Semver Component\n============================\n\nA small Semantic Versioning helper library.\n\nValidation Continues Versions. Finding next possible version version increments. \n\nRequirements\n------------\n\nYou need at least PHP 7.1\n\nInstallation\n------------\n\nTo install this package, add `rollerworks/version` to your composer.json\n\n```bash\n$ php composer.phar require rollerworks/version\n```\n\nThis command requires you to have Composer installed globally, as explained\nin the [installation chapter](https://getcomposer.org/doc/00-intro.md)\nof the Composer documentation.\n\nNow, Composer will automatically download all required files, and install them\nfor you.\n\nBasic usage\n-----------\n\n```php\nrequire 'vendor/autoload.php';\n\nuse Rollerworks\\Component\\Version\\Version;\nuse Rollerworks\\Component\\Version\\VersionsValidator;\n\n// Creates an immutable Version value-object.\n// Any call to this object will produce a new Version object\n$version = Version::fromString('v1.3.2');\n\n$newVersion = $version-\u003eincrease('major');  // v2.0.0\n$newVersion = $version-\u003eincrease('minor');  // v1.4.0\n$newVersion = $version-\u003eincrease('next');   // v1.4.0\n$newVersion = $version-\u003eincrease('patch');  // v1.3.3\n$newVersion = $version-\u003eincrease('stable'); // v1.4.0\n\n$newVersion = $version-\u003eincrease('alpha'); // v1.4.0-ALPHA1\n$newVersion = $version-\u003eincrease('beta');  // v1.4.0-BETA1\n$newVersion = $version-\u003eincrease('rc');    // v1.4.0-RC1\n\n// ...\n// Increasing minor or patch is prohibited until the meta-ver (alpha,beta,rc) is 0\n// For patch this resolves to \"next\".\n\n$version = Version::fromString('v1.4.0-BETA1');\n$newVersion = $version-\u003eincrease('beta');   // v1.4.0-BETA2\n$newVersion = $version-\u003eincrease('rc');     // v1.4.0-RC1\n$newVersion = $version-\u003eincrease('major');  // v1.4.0\n$newVersion = $version-\u003eincrease('next');   // v1.4.0-BETA2\n$newVersion = $version-\u003eincrease('patch');  // v1.4.0-BETA2\n$newVersion = $version-\u003eincrease('stable'); // v1.4.0\n\n// Version validation\n// ... //\n\n$existingVersions = [\n    Version::fromString('0.1.0'),\n    Version::fromString('v1.0.0-beta1'),\n    Version::fromString('v1.0.0-beta2'),\n    Version::fromString('v1.0.0-beta6'),\n    Version::fromString('v1.0.0-beta7'),\n    Version::fromString('1.0.0'),\n    Version::fromString('v1.0.1'),\n    Version::fromString('v1.1.0'),\n    Version::fromString('v2.0.0'),\n    Version::fromString('v3.5-beta1'),\n];\n\n$validator = new ContinuesVersionsValidator(...$existingVersions); // Expects the versions as a variadic arguments\n//$validator = new ContinuesVersionsValidator(); // No existing versions\n\nVersionsValidator::isVersionContinues(Version::fromString('v1.1.1'));      // true\nVersionsValidator::isVersionContinues(Version::fromString('1.0.2'));       // true\nVersionsValidator::isVersionContinues(Version::fromString('1.1.1.'));      // true\nVersionsValidator::isVersionContinues(Version::fromString('2.0.1.'));      // true\nVersionsValidator::isVersionContinues(Version::fromString('3.5.0-beta2')); // true\nVersionsValidator::isVersionContinues(Version::fromString('3.5.0'));       // true\n\n// A new minor or major version is not considered acceptable when there are already higher\n// versions. Only patch releases are accepted then.\nVersionsValidator::isVersionContinues(Version::fromString('0.2.0'));        // false\nVersionsValidator::isVersionContinues(Version::fromString('v1.0.0-beta8')); // false\nVersionsValidator::isVersionContinues(Version::fromString('v1.2'));         // false\nVersionsValidator::isVersionContinues(Version::fromString('v2.1'));         // false\nVersionsValidator::isVersionContinues(Version::fromString('v3.5-alpha1'));  // false\nVersionsValidator::isVersionContinues(Version::fromString('v3.5-beta3'));   // false\nVersionsValidator::isVersionContinues(Version::fromString('v3.6'));         // false\n\n// A list of possible versions with respect to the major.minor bounds of any existing version\n// For higher major.minor versions then validated only suggests a patch release, otherwise\n// all possible increments till the next stable major are suggested.\n$possibleVersions = $validator-\u003egetPossibleVersions();\n```\n\nVersioning\n----------\n\nFor transparency and insight into the release cycle, and for striving\nto maintain backward compatibility, this package is maintained under\nthe Semantic Versioning guidelines as much as possible.\n\nReleases will be numbered with the following format:\n\n`\u003cmajor\u003e.\u003cminor\u003e.\u003cpatch\u003e`\n\nAnd constructed with the following guidelines:\n\n* Breaking backward compatibility bumps the major (and resets the minor and patch)\n* New additions without breaking backward compatibility bumps the minor (and resets the patch)\n* Bug fixes and misc changes bumps the patch\n\nFor more information on SemVer, please visit \u003chttp://semver.org/\u003e.\n\nLicense\n-------\n\nThe source of this package is subject to the MIT license that is bundled\nwith this source code in the file [LICENSE](LICENSE).\n\nThis library is maintained by [Sebastiaan Stok](https://github.com/sstok).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frollerworks%2Fversion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frollerworks%2Fversion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frollerworks%2Fversion/lists"}