PHPackages                             zero-to-prod/validate-semver-cli - 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/validate-semver-cli

ActiveLibrary

zero-to-prod/validate-semver-cli
================================

A CLI for validating a semantic version string.

v1.1.0(1y ago)12751MITPHPPHP &gt;=8.1CI passing

Since Jan 28Pushed 8mo ago1 watchersCompare

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

READMEChangelog (5)Dependencies (6)Versions (6)Used By (1)

Zerotoprod\\ValidateSemverCli
=============================

[](#zerotoprodvalidatesemvercli)

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

[![Repo](https://camo.githubusercontent.com/9a90a3efeee26aed7d7f2feee9cd84566a26f9c362cc773b184d076210906e1c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6769746875622d677261793f6c6f676f3d676974687562)](https://github.com/zero-to-prod/validate-semver-cli)[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/4b980e287f1290eda2e0c7eb263930a5cc690c98c6c36644ac2c850b91331c8c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7a65726f2d746f2d70726f642f76616c69646174652d73656d7665722d636c692f746573742e796d6c3f6c6162656c3d74657374)](https://github.com/zero-to-prod/validate-semver-cli/actions)[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/404e605d842eb1f6c5729ba4d3fc37b9c3aaedb34dcbab7e1827c690e60866d7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7a65726f2d746f2d70726f642f76616c69646174652d73656d7665722d636c692f6261636b77617264735f636f6d7061746962696c6974792e796d6c3f6c6162656c3d6261636b77617264735f636f6d7061746962696c697479)](https://github.com/zero-to-prod/validate-semver-cli/actions)[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/bc59cb2c10a40d4bb38a491f8c4fc0a0e178f11665e4cbb6a2d878efb75170fe/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7a65726f2d746f2d70726f642f76616c69646174652d73656d7665722d636c692f6275696c645f646f636b65725f696d6167652e796d6c3f6c6162656c3d6275696c645f646f636b65725f696d616765)](https://github.com/zero-to-prod/validate-semver-cli/actions)[![Packagist Downloads](https://camo.githubusercontent.com/474682269420613495d25f418cb64c7d5b4eb9a7ffce579469011080745c2d96/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a65726f2d746f2d70726f642f76616c69646174652d73656d7665722d636c693f636f6c6f723d626c7565)](https://packagist.org/packages/zero-to-prod/validate-semver-cli/stats)[![php](https://camo.githubusercontent.com/1da5ae14ca71b618544e5b4e11e624a70abcc1de240ae0be79ca745177ce0506/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7a65726f2d746f2d70726f642f76616c69646174652d73656d7665722d636c692e7376673f636f6c6f723d707572706c65)](https://packagist.org/packages/zero-to-prod/validate-semver-cli/stats)[![Packagist Version](https://camo.githubusercontent.com/e9d57563aeaab7c362b2a59f811a002d371d72119afd4177e8facca1fdb4c1f8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a65726f2d746f2d70726f642f76616c69646174652d73656d7665722d636c693f636f6c6f723d663238643161)](https://packagist.org/packages/zero-to-prod/validate-semver-cli)[![License](https://camo.githubusercontent.com/e6dafab742489ae7cc09acbe2b019df5e3ee6b8e4655b52f8accdd7af9217824/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7a65726f2d746f2d70726f642f76616c69646174652d73656d7665722d636c693f636f6c6f723d70696e6b)](https://github.com/zero-to-prod/validate-semver-cli/blob/main/LICENSE.md)[![wakatime](https://camo.githubusercontent.com/0e6c418d398582f11b24dd129420040772a6f18e2f138978d04a0de4e6748a7f/68747470733a2f2f77616b6174696d652e636f6d2f62616467652f6769746875622f7a65726f2d746f2d70726f642f76616c69646174652d73656d7665722d636c692e737667)](https://wakatime.com/badge/github/zero-to-prod/validate-semver-cli)[![Hits-of-Code](https://camo.githubusercontent.com/7be5c2aac3780d107dcc5a502cf4b0e5c1f9458898aa69e2683a87741f46d0fd/68747470733a2f2f686974736f66636f64652e636f6d2f6769746875622f7a65726f2d746f2d70726f642f76616c69646174652d73656d7665722d636c693f6272616e63683d6d61696e)](https://hitsofcode.com/github/zero-to-prod/validate-semver-cli/view?branch=main)

Contents
--------

[](#contents)

- [Introduction](#introduction)
- [Requirements](#requirements)
- [Installation](#installation)
- [Documentation Publishing](#documentation-publishing)
    - [Automatic Documentation Publishing](#automatic-documentation-publishing)
- [Usage](#usage)
    - [Available Commands](#available-commands)
        - [`validate-semver-cli:validate`](#validate-semver-clivalidate)
        - [`validate-semver-cli:show-regex`](#validate-semver-clishow-regex)
        - [`validate-semver-cli:src`](#validate-semver-clisrc)
- [Docker Image](#docker-image)
- [Local Development](./LOCAL_DEVELOPMENT.md)
- [Image Development](./IMAGE_DEVELOPMENT.md)
- [Contributing](#contributing)

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

[](#introduction)

A CLI for validating a semantic version string.

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

[](#requirements)

- PHP 8.1 or higher.

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

[](#installation)

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

```
composer require zero-to-prod/validate-semver-cli
```

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/validate-semver-cli)
vendor/bin/zero-to-prod-validate-semver-cli

# Publish to custom directory
vendor/bin/zero-to-prod-validate-semver-cli /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-validate-semver-cli"
        ],
        "post-update-cmd": [
            "zero-to-prod-validate-semver-cli"
        ]
    }
}
```

Usage
-----

[](#usage)

Run this command to see the available commands:

```
vendor/bin/validate-semver-cli list
```

### Available Commands

[](#available-commands)

The CLI provides three main commands for working with semantic version validation:

#### `validate-semver-cli:validate`

[](#validate-semver-clivalidate)

Validates a semantic version string and returns the string if valid, or empty output if invalid.

**Usage:**

```
vendor/bin/validate-semver-cli validate-semver-cli:validate
```

**Arguments:**

- `semver` (required) - The semantic version string to validate

**Examples:**

Valid semantic version:

```
vendor/bin/validate-semver-cli validate-semver-cli:validate "1.2.3"
```

**Output:**

```
1.2.3

```

Valid semantic version with pre-release:

```
vendor/bin/validate-semver-cli validate-semver-cli:validate "2.0.0-alpha.1"
```

**Output:**

```
2.0.0-alpha.1

```

Valid semantic version with build metadata:

```
vendor/bin/validate-semver-cli validate-semver-cli:validate "1.0.0+20230101"
```

**Output:**

```
1.0.0+20230101

```

Invalid semantic version:

```
vendor/bin/validate-semver-cli validate-semver-cli:validate "1.2"
```

**Output:**

```

```

#### `validate-semver-cli:show-regex`

[](#validate-semver-clishow-regex)

Displays the regular expression pattern used to validate semantic version strings.

**Usage:**

```
vendor/bin/validate-semver-cli validate-semver-cli:show-regex
```

**Arguments:** None

**Example:**

```
vendor/bin/validate-semver-cli validate-semver-cli:show-regex
```

**Output:**

```
^(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(?:-(?P(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$

```

#### `validate-semver-cli:src`

[](#validate-semver-clisrc)

Displays the project's source repository URL.

**Usage:**

```
vendor/bin/validate-semver-cli validate-semver-cli:src
```

**Arguments:** None

**Example:**

```
vendor/bin/validate-semver-cli validate-semver-cli:src
```

**Output:**

```
https://github.com/zero-to-prod/validate-semver-cli

```

Docker Image
------------

[](#docker-image)

You can also run the cli using the [docker image](https://hub.docker.com/repository/docker/davidsmith3/validate-semver-cli/general):

```
docker run --rm davidsmith3/validate-semver-cli
```

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

[](#contributing)

Contributions, issues, and feature requests are welcome! Feel free to check the [issues](https://github.com/zero-to-prod/validate-semver-cli/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

33

—

LowBetter than 75% of packages

Maintenance52

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

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

Total

5

Last Release

471d 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 (17 commits)")

---

Tags

zero-to-prodvalidate-semver-cli

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  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)
