PHPackages                             zero-to-prod/data-model-semver - 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. zero-to-prod/data-model-semver

ActiveLibrary

zero-to-prod/data-model-semver
==============================

A DataModel Representing the Components of a SemVer String

v71.1.0(8mo ago)1470MITPHPPHP &gt;=7.1CI passing

Since Nov 10Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/zero-to-prod/data-model-semver)[ Packagist](https://packagist.org/packages/zero-to-prod/data-model-semver)[ Docs](https://github.com/zero-to-prod/data-model-semver)[ Fund](https://github.com/sponsors/zero-to-prod)[ RSS](/packages/zero-to-prod-data-model-semver/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (4)Versions (10)Used By (0)

Zerotoprod\\DataModelSemver
===========================

[](#zerotoproddatamodelsemver)

[![](art/logo.png)](art/logo.png)

[![Repo](https://camo.githubusercontent.com/9a90a3efeee26aed7d7f2feee9cd84566a26f9c362cc773b184d076210906e1c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6769746875622d677261793f6c6f676f3d676974687562)](https://github.com/zero-to-prod/data-model-semver)[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/678326b8ea4666d8b78f6e80ec5d993c5537dde17e622c2fc8034a2742a78b92/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7a65726f2d746f2d70726f642f646174612d6d6f64656c2d73656d7665722f746573742e796d6c3f6c6162656c3d74657374)](https://github.com/zero-to-prod/data-model-semver/actions)[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/efbd5b1a97a93c6b06565da18d2a64bcc3e6af93b8e852b23ada4828572108ae/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7a65726f2d746f2d70726f642f646174612d6d6f64656c2d73656d7665722f6261636b77617264735f636f6d7061746962696c6974792e796d6c3f6c6162656c3d6261636b77617264735f636f6d7061746962696c697479)](https://github.com/zero-to-prod/data-model-semver/actions)[![Packagist Downloads](https://camo.githubusercontent.com/de0cbc29292839b5e7f7525312627378e773f7127ba247991e108484ede19b92/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a65726f2d746f2d70726f642f646174612d6d6f64656c2d73656d7665723f636f6c6f723d626c7565)](https://packagist.org/packages/zero-to-prod/data-model-semver/stats)[![php](https://camo.githubusercontent.com/564ca9ed43ab92aad9f05c93f6de877b1c05775b780f648bd0523e05e1f56e34/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7a65726f2d746f2d70726f642f646174612d6d6f64656c2d73656d7665722e7376673f636f6c6f723d707572706c65)](https://packagist.org/packages/zero-to-prod/data-model-semver/stats)[![Packagist Version](https://camo.githubusercontent.com/9f2e689f61f9bc4c99ac325e62f7c768d2119a875f9f9cef6c72786681fd9810/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a65726f2d746f2d70726f642f646174612d6d6f64656c2d73656d7665723f636f6c6f723d663238643161)](https://packagist.org/packages/zero-to-prod/data-model-semver)[![License](https://camo.githubusercontent.com/d4299e9c2476eea317379ae80d345447e56cbc3cf4d20c572f87d348a5341af5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7a65726f2d746f2d70726f642f646174612d6d6f64656c2d73656d7665723f636f6c6f723d70696e6b)](https://github.com/zero-to-prod/data-model-semver/blob/main/LICENSE.md)[![wakatime](https://camo.githubusercontent.com/db9af9d27be3e7ef4b41c98e7793f3c30d18eb0fb256bc02fd5d2d2cf1a6def9/68747470733a2f2f77616b6174696d652e636f6d2f62616467652f6769746875622f7a65726f2d746f2d70726f642f646174612d6d6f64656c2d73656d7665722e737667)](https://wakatime.com/badge/github/zero-to-prod/data-model-semver)[![Hits-of-Code](https://camo.githubusercontent.com/0a37e053d7d38ce2c4cec9d7ff24d9b92348a36de653a0177a8abce93cea0b74/68747470733a2f2f686974736f66636f64652e636f6d2f6769746875622f7a65726f2d746f2d70726f642f646174612d6d6f64656c2d73656d7665723f6272616e63683d6d61696e)](https://hitsofcode.com/github/zero-to-prod/data-model-semver/view?branch=main)

Contents
--------

[](#contents)

- [Introduction](#introduction)
- [Requirements](#requirements)
- [Installation](#installation)
- [Documentation Publishing](#documentation-publishing)
    - [Automatic Documentation Publishing](#automatic-documentation-publishing)
- [Usage](#usage)
    - [Helper Methods](#helper-methods)
- [Publishing DataModels](#publishing-datamodels)
- [Local Development](./LOCAL_DEVELOPMENT.md)
- [Contributing](#contributing)

Introduction
------------

[](#introduction)

A `DataModel` representing the components of a SemVer string.

Requirements
------------

[](#requirements)

- PHP 7.1 or higher.

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

[](#installation)

Install `Zerotoprod\DynamicSetter` via [Composer](https://getcomposer.org/):

```
composer require zero-to-prod/data-model-semver
```

This will add the package to your project's dependencies and create an autoloader entry for it.

Documentation Publishing
------------------------

[](#documentation-publishing)

You can publish this README to your local documentation directory.

This can be useful for providing documentation for AI agents.

This can be done using the included script:

```
# Publish to default location (./docs/zero-to-prod/data-model-semver)
vendor/bin/zero-to-prod-data-model-semver

# Publish to custom directory
vendor/bin/zero-to-prod-data-model-semver /path/to/your/docs
```

### Automatic Documentation Publishing

[](#automatic-documentation-publishing)

You can automatically publish documentation by adding the following to your `composer.json`:

```
{
    "scripts": {
        "post-install-cmd": [
            "zero-to-prod-data-model-semver"
        ],
        "post-update-cmd": [
            "zero-to-prod-data-model-semver"
        ]
    }
}
```

Usage
-----

[](#usage)

Pass a [SemVer](https://semver.org/) string to the `from()` method.

```
$Semver = \Zerotoprod\DataModelSemver\Semver::from('1.2.3-prerelease+meta');

echo $Semver->major; // 1
echo $Semver->minor; // 2
echo $Semver->patch; // 3
echo $Semver->prerelease; // prerelease
echo $Semver->buildmetadata; //meta
```

### Helper Methods

[](#helper-methods)

```
Semver::from('1.2.3-prerelease+meta')->toArray();
Semver::from('1.2.3-prerelease+meta')->toJson();
```

Publishing DataModels
---------------------

[](#publishing-datamodels)

You can directly import these files into your project like this:

```
./vendor/bin/data-model-semver app/DataModelSemver
```

The first argument is the destination of where the files are copied to.

Contributing
------------

[](#contributing)

Contributions, issues, and feature requests are welcome! Feel free to check the [issues](https://github.com/zero-to-prod/data-model-semver/issues) page if you want to contribute.

1. Fork the repository.
2. Create a new branch (`git checkout -b feature-branch`).
3. Commit changes (`git commit -m 'Add some feature'`).
4. Push to the branch (`git push origin feature-branch`).
5. Create a new Pull Request.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance60

Regular maintenance activity

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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 ~42 days

Recently: every ~58 days

Total

8

Last Release

251d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/502649f05d36c87d494988bd99193a4d908d345335d99c080928a726277371f5?d=identicon)[zero-to-prod](/maintainers/zero-to-prod)

---

Top Contributors

[![zero-to-prod](https://avatars.githubusercontent.com/u/61474950?v=4)](https://github.com/zero-to-prod "zero-to-prod (13 commits)")

---

Tags

datamodelphpsemversemverzero-to-proddata-model-semver

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zero-to-prod-data-model-semver/health.svg)

```
[![Health](https://phpackages.com/badges/zero-to-prod-data-model-semver/health.svg)](https://phpackages.com/packages/zero-to-prod-data-model-semver)
```

###  Alternatives

[zero-to-prod/data-model

Transforms Data into Type-Safe DTOs.

14226.2k32](/packages/zero-to-prod-data-model)

PHPackages © 2026

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