PHPackages                             sebastian/version - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. sebastian/version

ActiveLibrary[Testing &amp; Quality](/categories/testing)

sebastian/version
=================

Library that helps with managing the version number of Git-hosted PHP projects

7.0.0(4mo ago)6.6k893.4M↓26.1%36[1 issues](https://github.com/sebastianbergmann/version/issues)20BSD-3-ClausePHPPHP &gt;=8.4CI passing

Since Jan 5Pushed 4d ago9 watchersCompare

[ Source](https://github.com/sebastianbergmann/version)[ Packagist](https://packagist.org/packages/sebastian/version)[ Docs](https://github.com/sebastianbergmann/version)[ GitHub Sponsors](https://github.com/sebastianbergmann)[ Fund](https://liberapay.com/sebastianbergmann)[ RSS](/packages/sebastian-version/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (4)DependenciesVersions (30)Used By (20)

[![Latest Stable Version](https://camo.githubusercontent.com/7a2cc9a0464edea0cfe245927e9109998a554c34b3f42af15646bd4270a486f3/68747470733a2f2f706f7365722e707567782e6f72672f73656261737469616e2f76657273696f6e2f76)](https://packagist.org/packages/sebastian/version)

sebastian/version
=================

[](#sebastianversion)

**sebastian/version** is a library that helps with managing the version number of Git-hosted PHP projects.

Installation
------------

[](#installation)

You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):

```
composer require sebastian/version

```

If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:

```
composer require --dev sebastian/version

```

Usage
-----

[](#usage)

The constructor of the `SebastianBergmann\Version` class expects two parameters:

- `$release` is the version number of the latest release (`X.Y.Z`, for instance) or the name of the release series (`X.Y`) when no release has been made from that branch / for that release series yet.
- `$path` is the path to the directory (or a subdirectory thereof) where the sourcecode of the project can be found. Simply passing `__DIR__` here usually suffices.

Apart from the constructor, the `SebastianBergmann\Version` class has a single public method: `asString()`.

Here is a contrived example that shows the basic usage:

```
