PHPackages                             chippyash/semantic-version-updater - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. chippyash/semantic-version-updater

ActiveLibrary

chippyash/semantic-version-updater
==================================

Utility to update version tags during Jenkins builds

1.0.0(4y ago)0191GPL-3.0PHPPHP &gt;=8.0CI failing

Since Jul 10Pushed 4y ago1 watchersCompare

[ Source](https://github.com/chippyash/semantic-version-updater)[ Packagist](https://packagist.org/packages/chippyash/semantic-version-updater)[ RSS](/packages/chippyash-semantic-version-updater/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (3)Versions (7)Used By (0)

Semantic Version Updater
========================

[](#semantic-version-updater)

Build chain utility to update the semantic version for a PHP package

PHP Version support
-------------------

[](#php-version-support)

With the inexorable withdrawal of upstream library support for PHP&lt;V8, I've now also decided to remove support for &lt;V8. If you still need &lt;V8 support use a tagged version &lt;1 and build the package yourself. V1+ is PHP8 only.

Quality Assurance
-----------------

[](#quality-assurance)

[![PHP 8](https://camo.githubusercontent.com/7914866fcee2a09d79c8a613a49b05e8f916cb5f8a0fbcbecb18b3cc9419a0c5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382d626c75652e737667)](https://camo.githubusercontent.com/7914866fcee2a09d79c8a613a49b05e8f916cb5f8a0fbcbecb18b3cc9419a0c5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382d626c75652e737667)[![Build Status](https://camo.githubusercontent.com/2ac4368826f272ff5d05ec3ef0d7fe65f281416b96dcb24473bc1aee066932e7/68747470733a2f2f7472617669732d63692e6f72672f6368697070796173682f73656d616e7469632d76657273696f6e2d757064617465722e737667)](https://travis-ci.org/chippyash/semantic-version-updater)[![Test Coverage](https://camo.githubusercontent.com/0f24cc719947903d8830b063b3c93d8f74cb78f0852af318725674b67183699e/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f65326461643635633635353633353364616534622f746573745f636f766572616765)](https://codeclimate.com/github/chippyash/semantic-version-updater/test_coverage)

The above badges represent the current development branch. As a rule, I don't push to GitHub unless tests, coverage and usability are acceptable. This may not be true for short periods of time; on holiday, need code for some other downstream project etc. If you need stable code, use a tagged version.

See the [Test Contract](https://github.com/chippyash/semantic-version-updater/blob/master/docs/Test-Contract.md)

How
---

[](#how)

### Initialisation

[](#initialisation)

For a new package

add `"chippyash/semantic-version-updater":"*"` to your dev-requires section of the composer.json file

run `composer update`

run `vendor/bin/vupdate init` to create a new VERSION file in the root of your project

run

```
    git commit -am"add vupdate"

    git tag 0.0.0

    git push origin master --tags
```

### Manually updating the version and git tag

[](#manually-updating-the-version-and-git-tag)

During initial development, you'll want to have your package tagged at various points. You can keep your git tag version and the version contained in the VERSION file in sync with

```
bin/vupdate && cat VERSION | xargs git tag
```

Don't forget to push your tags to remote repo.

Once you have finished initial development and you think you are good to go, you can tag you package at its first 'real' release version. You can either run `bin/vupdate -pbcbreak` to update the major (M.n.n) part of the version number, or `bin/vupdate -o 1.0.0` to force the version. A one liner would be

```
bin/vupdate -pbcbreak && cat VERSION | xargs git tag && git commit -am"First release" && git push origin master --tags
```

Use `bin/vupdate -h` to see the help screen.

Use `bin/vupdate --version` for command version number.

### Employing into your build chain

[](#employing-into-your-build-chain)

The real purpose of the utility is to get it used in the build chain, updating the tag, pushing to git and then updating the Satis/Composer (or other repo) to tell it that a new version is available.

Download this repo as a zip and extract it. Move/copy the bin/vupdate file to somewhere on your PATH, e.g. /usr/local/bin/vupdate. You can also do this if you just want the executable phar on your local machine to be globally available.

Here is a jenkins job that we use in our build chain to update the version dependent on the branch name prefix:

```
VERSIONER=/usr/local/bin/vupdate
GIT=git

cd "${workingDir}";
${GIT} checkout ${gitBranch};
lastCommit=$(git log --branches | grep 'Merge pull request.* to master' | head -1)

if [[ $lastCommit == *"feature/"* ]] || [[ $lastCommit == *"release/"* ]]
then
        ${VERSIONER} -p feature;
        verType="Feature";
else
        ${VERSIONER};
        verType="Patch";
fi;

${GIT} commit -am"CD $verType Version update: $lastCommit";
cat VERSION | xargs ${GIT} tag;
${GIT} push origin ${gitBranch} --tags;
```

The $workingDir and $gitBranch parameters are sent to the job from the main build job. $gitBranch defaults to 'master';

Development
-----------

[](#development)

Clone the repo as normal.

Create a feature branch

run `composer update` to pull in the external libraries.

Commit your changes as normal and push to repo and make a pull request.

### The make file

[](#the-make-file)

Running `make` will rebuild the `bin/vupdate` phar file and push the changes to the repo. As such, it is only of any use to you if you have write access on the code repo.

You can run `make build` to just build the `bin/vupdate`

### Notes

[](#notes)

If you get `creating archive "/var/lib/jenkins/jobs/ci-version-updater-builder/workspace/bin/vupdate.phar" disabled by the php.ini setting phar.readonly `or something similar when using the make build tools, edit your php cli ini file and set `phar.readonly = Off`.

Acknowledgments
---------------

[](#acknowledgments)

I first wrote the vupdate.php script some years ago. At that time it relied on the 'herrera-io/version' package from [Kevin Herrara](https://packagist.org/users/kherge/). He's since abandoned that package, so I've included his original code in the source of this package. It still works just fine. You can find it in the 'src' directory, along with his original tests in the 'test' directory. The Test Contract can be found at `docs/Test-Contract.md`. He has a permissive license on his code, so feel free to use this package to get access to the original code if you need it in some other application.

The build routine managed by the Makefile relies on [Box](https://box-project.github.io/box2/). There is a box phar distribution in the bin directory which will be used by the makefile.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~282 days

Recently: every ~353 days

Total

6

Last Release

1819d ago

Major Versions

0.0.5 → 1.0.02021-05-22

PHP version history (2 changes)0.0.1PHP &gt;=5.6

1.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/198575568597b367c8b285de16d278018c8cf292c6c75c535270135c1eea0561?d=identicon)[chippyash](/maintainers/chippyash)

---

Top Contributors

[![akzincsystems](https://avatars.githubusercontent.com/u/73334506?v=4)](https://github.com/akzincsystems "akzincsystems (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/chippyash-semantic-version-updater/health.svg)

```
[![Health](https://phpackages.com/badges/chippyash-semantic-version-updater/health.svg)](https://phpackages.com/packages/chippyash-semantic-version-updater)
```

###  Alternatives

[phan/phan

A static analyzer for PHP

5.6k11.2M1.1k](/packages/phan-phan)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-soap/wsdl

Deals with WSDLs

173.5M12](/packages/php-soap-wsdl)[php-soap/wsdl-reader

A WSDL reader in PHP

212.3M9](/packages/php-soap-wsdl-reader)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
