{"id":13622938,"url":"https://github.com/tomzx/php-semver-checker","last_synced_at":"2025-05-16T01:04:54.776Z","repository":{"id":25584779,"uuid":"29018937","full_name":"tomzx/php-semver-checker","owner":"tomzx","description":"Compares two source sets and determines the appropriate semantic versioning to apply.","archived":false,"fork":false,"pushed_at":"2023-09-18T09:16:00.000Z","size":447,"stargazers_count":431,"open_issues_count":41,"forks_count":28,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-05-10T08:46:34.290Z","etag":null,"topics":["analyzer","inspection","php","ruleset","semver"],"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/tomzx.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2015-01-09T14:10:36.000Z","updated_at":"2025-03-24T12:10:45.000Z","dependencies_parsed_at":"2023-02-19T03:31:10.430Z","dependency_job_id":"a4b4419f-3990-4a84-b83e-afadcb4d621b","html_url":"https://github.com/tomzx/php-semver-checker","commit_stats":{"total_commits":230,"total_committers":7,"mean_commits":"32.857142857142854","dds":"0.25652173913043474","last_synced_commit":"616ec19c746db215b913c84495192c7f4f654284"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomzx%2Fphp-semver-checker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomzx%2Fphp-semver-checker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomzx%2Fphp-semver-checker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomzx%2Fphp-semver-checker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomzx","download_url":"https://codeload.github.com/tomzx/php-semver-checker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254448579,"owners_count":22072764,"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":["analyzer","inspection","php","ruleset","semver"],"created_at":"2024-08-01T21:01:26.030Z","updated_at":"2025-05-16T01:04:54.755Z","avatar_url":"https://github.com/tomzx.png","language":"PHP","funding_links":[],"categories":["Table of Contents","目录","PHP","Programming Languages","代码分析( Code Analysis )","代码分析 Code Analysis"],"sub_categories":["Code Analysis","代码分析 Code Analysis","Library"],"readme":"# PHP Semantic Versioning Checker\n\n[![License](https://poser.pugx.org/tomzx/php-semver-checker/license.svg)](https://packagist.org/packages/tomzx/php-semver-checker)\n[![Latest Stable Version](https://poser.pugx.org/tomzx/php-semver-checker/v/stable.svg)](https://packagist.org/packages/tomzx/php-semver-checker)\n[![Latest Unstable Version](https://poser.pugx.org/tomzx/php-semver-checker/v/unstable.svg)](https://packagist.org/packages/tomzx/php-semver-checker)\n[![Build Status](https://img.shields.io/github/workflow/status/tomzx/php-semver-checker/Continuous%20integration.svg)](https://github.com/tomzx/php-semver-checker/actions?query=workflow%3A%22Continuous+integration%22)\n[![Code Coverage](https://img.shields.io/codecov/c/github/tomzx/php-semver-checker)](https://app.codecov.io/gh/tomzx/php-semver-checker/)\n[![Total Downloads](https://img.shields.io/packagist/dt/tomzx/php-semver-checker.svg)](https://packagist.org/packages/tomzx/php-semver-checker)\n\nPHP Semantic Versioning Checker is a console/library which allows you to inspect a set of before and after source code.\n\nAfter the inspection is completed, you are given a list of changes that have occurred between the two changesets following [Semantic Versioning 2.0.0](https://semver.org/). For each of these changes, the level of the change (MAJOR, MINOR, PATCH) will be given, as well as the location of the change (file and line number) and a reason as to why this level change is suggested.\n\n## For continuous integration\n\nIf you'd like to use `php-semver-checker` in your CI pipeline, we recommend you look at\n[`php-semver-checker-git`](https://github.com/tomzx/php-semver-checker-git) which integrates with Git and will compare\nyour latest changes with the latest Git tag of your repository.\n\n## Semantic Versioning 2.0.0 Overview\n\nGiven a version number MAJOR.MINOR.PATCH, increment the:\n\n* MAJOR version when you make incompatible API changes,\n* MINOR version when you add functionality in a backwards-compatible manner, and\n* PATCH version when you make backwards-compatible bug fixes.\n\n## Getting started\n\nAs this is still an alpha package, it is not suggested to include `php-semver-checker` directly in your composer.json. There are however a couple ways to use the tool:\n\n1. **Preferred method** Download the [latest .phar build](http://psvc.coreteks.org/php-semver-checker.phar). Note that the .phar build is generally less bleeding edge than the following methods.\n2. `php composer.phar create-project tomzx/php-semver-checker --stability=dev` will clone to a new php-semver-checker folder in your current working directory\n3. `git clone https://github.com/tomzx/php-semver-checker.git` and `php composer.phar install` in the newly cloned directory.\n\nSee the example section for examples of how to use the tool.\n\n### Building `php-semver-checker.phar`\n\nFirst, make sure you have [box](https://github.com/box-project/box2) installed. Then, in the base directory, you can run the following command which will generate the `php-semver-checker.phar` file.\n\n```\nbox build\n```\n\n## Current ruleset \u0026 verification codes\n\nSee [`docs/Ruleset.md`](docs/Ruleset.md) for an exhaustive list of currently supported (and to come) ruleset.\n\nVerification codes are a mean to uniquely identify a semantic versioning trigger (a condition which upon detection, requires your code changes to be versioned).\n\n## Example\n\n```bash\nphp bin/php-semver-checker compare tests/fixtures/before tests/fixtures/after\n\nSuggested semantic versioning change: MAJOR\n\nClass (MAJOR)\n+-------+--------------------------------------------------------------+------------------------------------------------------------+--------------------------------------------+------+\n| Level | Location                                                     | Target                                                     | Reason                                     | Code |\n+-------+--------------------------------------------------------------+------------------------------------------------------------+--------------------------------------------+------+\n| MAJOR | tests\\fixtures\\before\\ClassRemoved.php:5                     | fixtures\\ClassRemoved                                      | Class was removed.                         | V005 |\n| MAJOR | tests\\fixtures\\after\\ClassMethodAdded.php:7                  | fixtures\\ClassMethodAdded::publicMethod                    | [public] Method has been added.            | V015 |\n| MAJOR | tests\\fixtures\\after\\ClassMethodAdded.php:12                 | fixtures\\ClassMethodAdded::protectedMethod                 | [protected] Method has been added.         | V016 |\n| MAJOR | tests\\fixtures\\after\\ClassMethodParameterChanged.php:7       | fixtures\\ClassMethodParameterChanged::publicMethod         | [public] Method parameter changed.         | V010 |\n| MAJOR | tests\\fixtures\\after\\ClassMethodParameterChanged.php:12      | fixtures\\ClassMethodParameterChanged::protectedMethod      | [protected] Method parameter changed.      | V011 |\n| MAJOR | tests\\fixtures\\before\\ClassMethodRemoved.php:7               | fixtures\\ClassMethodRemoved::publicMethod                  | [public] Method has been removed.          | V006 |\n| MAJOR | tests\\fixtures\\before\\ClassMethodRemoved.php:12              | fixtures\\ClassMethodRemoved::protectedMethod               | [protected] Method has been removed.       | V007 |\n| MAJOR | tests\\fixtures\\after\\ClassPropertyAdded.php:7                | fixtures\\ClassPropertyAdded::$a                            | [public] Property has been added.          | V019 |\n| MAJOR | tests\\fixtures\\after\\ClassPropertyAdded.php:9                | fixtures\\ClassPropertyAdded::$b                            | [protected] Property has been added.       | V020 |\n| MAJOR | tests\\fixtures\\before\\ClassPropertyRemoved.php:7             | fixtures\\ClassPropertyRemoved::$a                          | [public] Property has been removed.        | V008 |\n| MAJOR | tests\\fixtures\\before\\ClassPropertyRemoved.php:9             | fixtures\\ClassPropertyRemoved::$b                          | [protected] Property has been removed.     | V009 |\n| MINOR | tests\\fixtures\\after\\ClassAdded.php:5                        | fixtures\\ClassAdded                                        | Class was added.                           | V014 |\n| PATCH | tests\\fixtures\\after\\ClassMethodAdded.php:17                 | fixtures\\ClassMethodAdded::privateMethod                   | [private] Method has been added.           | V028 |\n| PATCH | tests\\fixtures\\after\\ClassMethodImplementationChanged.php:7  | fixtures\\ClassMethodImplementationChanged::publicMethod    | [public] Method implementation changed.    | V023 |\n| PATCH | tests\\fixtures\\after\\ClassMethodImplementationChanged.php:12 | fixtures\\ClassMethodImplementationChanged::protectedMethod | [protected] Method implementation changed. | V024 |\n| PATCH | tests\\fixtures\\after\\ClassMethodImplementationChanged.php:17 | fixtures\\ClassMethodImplementationChanged::privateMethod   | [private] Method implementation changed.   | V025 |\n| PATCH | tests\\fixtures\\after\\ClassMethodParameterChanged.php:17      | fixtures\\ClassMethodParameterChanged::privateMethod        | [private] Method parameter changed.        | V031 |\n| PATCH | tests\\fixtures\\after\\ClassMethodParameterNameChanged.php:7   | fixtures\\ClassMethodParameterNameChanged::publicMethod     | [public] Method parameter name changed.    | V060 |\n| PATCH | tests\\fixtures\\after\\ClassMethodParameterNameChanged.php:12  | fixtures\\ClassMethodParameterNameChanged::protectedMethod  | [protected] Method parameter name changed. | V061 |\n| PATCH | tests\\fixtures\\after\\ClassMethodParameterNameChanged.php:17  | fixtures\\ClassMethodParameterNameChanged::privateMethod    | [private] Method parameter name changed.   | V062 |\n| PATCH | tests\\fixtures\\before\\ClassMethodRemoved.php:17              | fixtures\\ClassMethodRemoved::privateMethod                 | [private] Method has been removed.         | V029 |\n| PATCH | tests\\fixtures\\after\\ClassPropertyAdded.php:11               | fixtures\\ClassPropertyAdded::$c                            | [private] Property has been added.         | V026 |\n| PATCH | tests\\fixtures\\before\\ClassPropertyRemoved.php:11            | fixtures\\ClassPropertyRemoved::$c                          | [private] Property has been removed.       | V027 |\n+-------+--------------------------------------------------------------+------------------------------------------------------------+--------------------------------------------+------+\n\nFunction (MAJOR)\n+-------+----------------------------------------------------------+-----------------------------------------------------------------------+----------------------------------+------+\n| Level | Location                                                 | Target                                                                | Reason                           | Code |\n+-------+----------------------------------------------------------+-----------------------------------------------------------------------+----------------------------------+------+\n| MAJOR | tests\\fixtures\\before\\FunctionRemoved.php:5              | fixtures\\functionRemoved::functionRemoved                             | Function has been removed.       | V001 |\n| MAJOR | tests\\fixtures\\before\\FunctionParameterChanged.php:5     | fixtures\\functionParameterChanged::functionParameterChanged           | Function parameter changed.      | V002 |\n| MINOR | tests\\fixtures\\after\\FunctionAdded.php:5                 | fixtures\\functionAdded::functionAdded                                 | Function has been added.         | V003 |\n| PATCH | tests\\fixtures\\after\\FunctionImplementationChanged.php:5 | fixtures\\functionImplementationChanged::functionImplementationChanged | Function implementation changed. | V004 |\n| PATCH | tests\\fixtures\\before\\FunctionParameterNameChanged.php:5 | fixtures\\functionParameterNameChanged::functionParameterNameChanged   | Function parameter name changed. | V067 |\n+-------+----------------------------------------------------------+-----------------------------------------------------------------------+----------------------------------+------+\n\nInterface (MAJOR)\n+-------+---------------------------------------------------------------+------------------------------------------------------------+-----------------------------------------+------+\n| Level | Location                                                      | Target                                                     | Reason                                  | Code |\n+-------+---------------------------------------------------------------+------------------------------------------------------------+-----------------------------------------+------+\n| MAJOR | tests\\fixtures\\before\\InterfaceRemoved.php:5                  | fixtures\\InterfaceRemoved                                  | Interface was removed.                  | V033 |\n| MAJOR | tests\\fixtures\\after\\InterfaceMethodAdded.php:7               | fixtures\\InterfaceMethodAdded::newMethod                   | [public] Method has been added.         | V034 |\n| MAJOR | tests\\fixtures\\after\\InterfaceMethodParameterChaged.php:7     | fixtures\\InterfaceMethodParameterChanged::newMethod        | [public] Method parameter changed.      | V036 |\n| MAJOR | tests\\fixtures\\before\\InterfaceMethodRemoved.php:7            | fixtures\\InterfaceMethodRemoved::newMethod                 | [public] Method has been removed.       | V035 |\n| MINOR | tests\\fixtures\\after\\InterfaceAdded.php:5                     | fixtures\\InterfaceAdded                                    | Interface was added.                    | V032 |\n| PATCH | tests\\fixtures\\after\\InterfaceMethodParameterNameChaged.php:7 | fixtures\\InterfaceMethodParameterNameChanged::publicMethod | [public] Method parameter name changed. | V063 |\n+-------+---------------------------------------------------------------+------------------------------------------------------------+-----------------------------------------+------+\n\nTrait (MAJOR)\n+-------+--------------------------------------------------------------+------------------------------------------------------------+--------------------------------------------+------+\n| Level | Location                                                     | Target                                                     | Reason                                     | Code |\n+-------+--------------------------------------------------------------+------------------------------------------------------------+--------------------------------------------+------+\n| MAJOR | tests\\fixtures\\before\\TraitRemoved.php:5                     | fixtures\\TraitRemoved                                      | Trait was removed.                         | V037 |\n| MAJOR | tests\\fixtures\\after\\TraitMethodAdded.php:7                  | fixtures\\TraitMethodAdded::publicMethod                    | [public] Method has been added.            | V047 |\n| MAJOR | tests\\fixtures\\after\\TraitMethodAdded.php:12                 | fixtures\\TraitMethodAdded::protectedMethod                 | [protected] Method has been added.         | V048 |\n| MAJOR | tests\\fixtures\\after\\TraitMethodAdded.php:17                 | fixtures\\TraitMethodAdded::privateMethod                   | [private] Method has been added.           | V057 |\n| MAJOR | tests\\fixtures\\after\\TraitMethodParameterChanged.php:7       | fixtures\\TraitMethodParameterChanged::publicMethod         | [public] Method parameter changed.         | V042 |\n| MAJOR | tests\\fixtures\\after\\TraitMethodParameterChanged.php:12      | fixtures\\TraitMethodParameterChanged::protectedMethod      | [protected] Method parameter changed.      | V043 |\n| MAJOR | tests\\fixtures\\after\\TraitMethodParameterChanged.php:17      | fixtures\\TraitMethodParameterChanged::privateMethod        | [private] Method parameter changed.        | V059 |\n| MAJOR | tests\\fixtures\\before\\TraitMethodRemoved.php:7               | fixtures\\TraitMethodRemoved::publicMethod                  | [public] Method has been removed.          | V038 |\n| MAJOR | tests\\fixtures\\before\\TraitMethodRemoved.php:12              | fixtures\\TraitMethodRemoved::protectedMethod               | [protected] Method has been removed.       | V039 |\n| MAJOR | tests\\fixtures\\before\\TraitMethodRemoved.php:17              | fixtures\\TraitMethodRemoved::privateMethod                 | [private] Method has been removed.         | V058 |\n| MAJOR | tests\\fixtures\\after\\TraitPropertyAdded.php:7                | fixtures\\TraitPropertyAdded::$a                            | [public] Property has been added.          | V049 |\n| MAJOR | tests\\fixtures\\after\\TraitPropertyAdded.php:9                | fixtures\\TraitPropertyAdded::$b                            | [protected] Property has been added.       | V050 |\n| MAJOR | tests\\fixtures\\after\\TraitPropertyAdded.php:11               | fixtures\\TraitPropertyAdded::$c                            | [private] Property has been added.         | V055 |\n| MAJOR | tests\\fixtures\\before\\TraitPropertyRemoved.php:7             | fixtures\\TraitPropertyRemoved::$a                          | [public] Property has been removed.        | V040 |\n| MAJOR | tests\\fixtures\\before\\TraitPropertyRemoved.php:9             | fixtures\\TraitPropertyRemoved::$b                          | [protected] Property has been removed.     | V041 |\n| MAJOR | tests\\fixtures\\before\\TraitPropertyRemoved.php:11            | fixtures\\TraitPropertyRemoved::$c                          | [private] Property has been removed.       | V056 |\n| MINOR | tests\\fixtures\\after\\TraitAdded.php:5                        | fixtures\\TraitAdded                                        | Trait was added.                           | V046 |\n| PATCH | tests\\fixtures\\after\\TraitMethodImplementationChanged.php:7  | fixtures\\TraitMethodImplementationChanged::publicMethod    | [public] Method implementation changed.    | V052 |\n| PATCH | tests\\fixtures\\after\\TraitMethodImplementationChanged.php:12 | fixtures\\TraitMethodImplementationChanged::protectedMethod | [protected] Method implementation changed. | V053 |\n| PATCH | tests\\fixtures\\after\\TraitMethodImplementationChanged.php:17 | fixtures\\TraitMethodImplementationChanged::privateMethod   | [private] Method implementation changed.   | V054 |\n| PATCH | tests\\fixtures\\after\\TraitMethodParameterNameChanged.php:7   | fixtures\\TraitMethodParameterNameChanged::publicMethod     | [public] Method parameter name changed.    | V064 |\n| PATCH | tests\\fixtures\\after\\TraitMethodParameterNameChanged.php:12  | fixtures\\TraitMethodParameterNameChanged::protectedMethod  | [protected] Method parameter name changed. | V065 |\n| PATCH | tests\\fixtures\\after\\TraitMethodParameterNameChanged.php:17  | fixtures\\TraitMethodParameterNameChanged::privateMethod    | [private] Method parameter name changed.   | V066 |\n+-------+--------------------------------------------------------------+------------------------------------------------------------+--------------------------------------------+------+\n\n[Scanned files] Before: 26, After: 27, Identical: 0\nTime: 1.43 seconds, Memory: 5.123 MB\n```\n\n## Contributing\n### Adding new rules\n\n* Add the rules to the `docs/Ruleset.md` document\n* Run `php scripts/extract-rules-from-ruleset.php` to generate an up to date array to paste in the `Configuration/LevelMapping.php` file\n* Update the documentation @ https://github.com/tomzx/php-semver-checker-docs\n\n## License\n\nThe code is licensed under the [MIT license](http://choosealicense.com/licenses/mit/). See [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomzx%2Fphp-semver-checker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomzx%2Fphp-semver-checker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomzx%2Fphp-semver-checker/lists"}