0

Hi I would like to update a semantic version number using php for a three digit system in string form. An example :

'1.0.0' => function => '1.0.1'
'1.0.12' => function => '1.0.13'
Does anyone know a solution to this problem? Thanks in advance
Jip Helsen
  • 1,034
  • 4
  • 15
  • 30
  • Will this just be for the next **patch** version? Are you able to provide a little more context? Is there anything you've tried so far? – Rwd Dec 05 '21 at 11:19

2 Answers2

1

All the answers you want for the semantic-versioning is you can get in,

PHLAK/SemVer

Composer also have the library for the same but the methods are easy from SemVer.

1

Using the following code snippet for this:

    $parts = \explode('.', $previousTag, 3);
    $newTag = $parts[0] . '.' . $parts[1] . '.' . (++$parts[2]);

Ignoring here edge cases for alpha, beta, rc, ... releases.

Alexander Schranz
  • 2,154
  • 2
  • 25
  • 42