elkadrey / version-bump
A Composer plugin that allows you to manage versioning similar to npm version. It supports patch, minor, major, prepatch, preminor, premajor, and prerelease versioning while integrating with Git for tagging and commits
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:composer-plugin
Requires
- php: >=7.4
- composer-plugin-api: ^2.0
- composer/composer: ^2.8
- symfony/process: *
This package is auto-updated.
Last update: 2025-02-28 18:27:25 UTC
README
A Composer plugin that allows you to manage versioning similar to npm version
. It supports patch
, minor
, major
, prepatch
, preminor
, premajor
, and prerelease
versioning while integrating with Git for tagging and commits.
🚀 Features
- Easily update version numbers in
composer.json
- Automatically commit and tag new versions in Git
- Supports pre-release versions (
beta
) - Compatible with semantic versioning (SemVer)
📥 Installation
Install the plugin globally or in a specific project:
composer require elkadrey/version-bump --dev
If using locally, require it as a path repository:
composer config repositories.version-bump '{"type": "path", "url": "../path-to-plugin"}'
composer require elkadrey/version-bump:dev-main
🔧 Usage
Run the following command to manage versioning:
composer version <command>
Set a specific version manually:
composer version <version>
This will set the version in composer.json
to exactly what <version>
is.
🎯 Available Commands
Command | Description |
---|---|
prerelease |
Only increment beta version (beta.1 → beta.2 ) |
patch |
Bump patch version (1.0.0 → 1.0.1) |
minor |
Bump minor version (1.0.0 → 1.1.0) |
major |
Bump major version (1.0.0 → 2.0.0) |
prepatch |
Bump pre-release patch (1.0.0 → 1.0.1-beta.1) |
preminor |
Bump pre-release minor (1.0.0 → 1.1.0-beta.1) |
premajor |
Bump pre-release major (1.0.0 → 2.0.0-beta.1) |
<version> |
Set version to <version> |
--show |
Show the current version |
--no-git |
Skip Git commit and tagging |
📌 Examples
🔹 Standard Version Bumps
composer version patch # 1.0.0 → 1.0.1 composer version minor # 1.0.1 → 1.1.0 composer version major # 1.1.0 → 2.0.0
🔹 Pre-release Versioning
composer version prepatch # 1.0.0 → 1.0.1-beta.1 composer version preminor # 1.0.0 → 1.1.0-beta.1 composer version premajor # 1.0.0 → 2.0.0-beta.1
🔹 Increment Only Beta Version
composer version prerelease # 1.0.0-beta.1 → 1.0.0-beta.2
🔹 Set a Specific Version
composer version 2.1.5 # Sets the version to 2.1.5 in composer.json
🔹 Skipping Git Operations
composer version patch --no-git # Updates version without Git commit/tag
🛠Development
Clone the repository and install dependencies:
git clone https://github.com/elkadrey/version-bump.git
cd version-bump
composer install
Test locally using a path repository in another project:
composer config repositories.local '{"type": "path", "url": "../version-bump"}'
composer require elkadrey/version-bump:dev-main
📜 License
This project is licensed under the MIT License.