{"id":28420426,"url":"https://github.com/pxlwidgets/php-composer-version","last_synced_at":"2026-04-30T11:36:10.319Z","repository":{"id":34937271,"uuid":"192715440","full_name":"PXLWidgets/php-composer-version","owner":"PXLWidgets","description":"A small CLI tool that bumps versions of php-composer packages, similar to how npm version works.","archived":false,"fork":false,"pushed_at":"2023-01-27T01:37:26.000Z","size":46,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-13T09:46:03.756Z","etag":null,"topics":["cli","composer","git","npm","semver","tag","versioning"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@pxlwidgets/php-composer-version","language":"JavaScript","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/PXLWidgets.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}},"created_at":"2019-06-19T11:01:39.000Z","updated_at":"2025-02-16T03:41:06.000Z","dependencies_parsed_at":"2023-02-15T03:50:32.295Z","dependency_job_id":null,"html_url":"https://github.com/PXLWidgets/php-composer-version","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/PXLWidgets/php-composer-version","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PXLWidgets%2Fphp-composer-version","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PXLWidgets%2Fphp-composer-version/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PXLWidgets%2Fphp-composer-version/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PXLWidgets%2Fphp-composer-version/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PXLWidgets","download_url":"https://codeload.github.com/PXLWidgets/php-composer-version/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PXLWidgets%2Fphp-composer-version/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262437929,"owners_count":23311060,"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":["cli","composer","git","npm","semver","tag","versioning"],"created_at":"2025-06-05T02:17:27.628Z","updated_at":"2026-04-30T11:36:10.283Z","avatar_url":"https://github.com/PXLWidgets.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-composer-version [![npm version](https://badge.fury.io/js/%40pxlwidgets%2Fphp-composer-version.svg)](https://badge.fury.io/js/%40pxlwidgets%2Fphp-composer-version)\n\nThis is a small CLI tool that bumps versions of php-composer packages, \nsimilar to how `npm version` works. On input of a new version number:\n\n1. If enabled through CLI option (`-p`), the new version is written to the project's `package.json`.\n2. The new version is written to the project's `composer.json`.\n3. Above changes are committed with a provided message if given (`-m`), or otherwise the version number as message.\n4. The created commit is tagged with the version number.\n\n[View changelog.][changelog]\n\n## installation\n\nInstall the package from npm, either globally for your system, or locally in the project.\nIt depends on your needs which approach to take.\n\n```bash\n$ npm install --save-dev @pxlwidgets/php-composer-version\n```\n\nIf you choose to install globally the script should be available under the name \n`php-composer-version`. Otherwise add an npm script that has access to the local \nversion to `package.json`:\n\n```json\n{\n    \"scripts\": {\n        \"bump-version\": \"php-composer-version\"\n    }\n}\n```\n \n## Usage \n\nRun the script from the command line from your project root. \n\n```bash\n# for global installations\n$ php-composer-version\n# for local installations\n$ npm run bump-version\n```\n\nThe script will then prompt you for the new version to write to the repository,\nand then perform the steps mentioned above:\n\n\u003e ```\n\u003e Enter new version number (current: 0.2.3)\n\u003e     version \u003e \n\u003e ```\n\nAlternatively the new version can be given as CLI argument with `-V` (capital v) or `--set-version`:\n\n```bash\n$ php-composer-version --set-version 0.2.4\n# OR\n$ php-composer-version -V 0.2.4\n```\n\nThis approach allows for automated versioning where interactive sessions won't work.\n## Checks\n\n- **Version comparison**\n\n  The entered version is compared against the current version to make sure that\n  the new version is greater than the current.\n  \n- **Version availability check**\n  \n  The entered version is compared against all git tags to make sure that no\n  tag already exists by the name of the version.\n    \n- **Git branch check**\n\n  By default the branch name to commit on is fixed to `master`. Most of the times\n  a new release should be a master revision. Exceptions might be revisions of \n  pre-release stages as `alpha`, `beta` or `rc`. To override the target branch\n  use the `--branch` option.\n  \n- **Git status check**\n\n  If the working directory is not clean, the user is asked permission to continue. \n  To skip the prompt and always allow additional changes,\n  use the `--allow-dirty` option flag.\n  \n### Self information\n\n#### `-h, --help`\nDisplays available options and short documentation, and then exits the process. \n\n#### `-v, --version`\n \nDisplays the current version of `php-composer-version` and then exits the process.\n\n### Versioning CLI Options:\n\n#### `-V, --set-version \u003cnew-version\u003e`\n\nSpecify the new package version to write. If not provided, `php-composer-version` \nwill prompt interactively. This argument is required for non-interactive sessions.\n\n#### `-b, --branch \u003cname\u003e`\nSet the target branch for the version commit. If on any other branch, the process will fail.\n\n#### `-m, --message \u003cmessage\u003e`\n\nSpecify a custom message for the version commit. Sequences of `%s` within given `\u003cmessage\u003e` is replaced with \nthe version number. If not provided, the new version number is used as the commit message.\n\n#### `-d, --allow-dirty`\n\nAllow additional changes to be committed with the version commit. If not given, and the\nGit stage contains changes, the user is asked interactively if the process should continue.\nIf this flag is given or the user confirms to continue, any currently staged changes will be\npart of the version commit.\n\nThis is primarily useful to include other version-related information, such as changelog updates,\nor generated documentation. \n\n#### `-p, --sync-package-json`\n\nToggle additional update of the version number in package.json.\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2019 PXL.Widgets B.V.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n[changelog]: https://github.com/PXLWidgets/php-composer-version/blob/master/CHANGELOG.md\n[readme]: https://github.com/PXLWidgets/php-composer-version/blob/master/README.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpxlwidgets%2Fphp-composer-version","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpxlwidgets%2Fphp-composer-version","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpxlwidgets%2Fphp-composer-version/lists"}