PHPackages                             typisttech/php-matrix - 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. [CLI &amp; Console](/categories/cli)
4. /
5. typisttech/php-matrix

ActiveProject[CLI &amp; Console](/categories/cli)

typisttech/php-matrix
=====================

List PHP versions that satisfy the required PHP constraint in composer.json.

v1.0.13(3mo ago)18.4k[7 PRs](https://github.com/typisttech/php-matrix/pulls)MITPHPPHP ^8.4CI passing

Since Dec 14Pushed 1mo agoCompare

[ Source](https://github.com/typisttech/php-matrix)[ Packagist](https://packagist.org/packages/typisttech/php-matrix)[ Docs](https://github.com/typisttech/php-matrix)[ Fund](https://typist.tech/donation/)[ GitHub Sponsors](https://github.com/tangrufus)[ RSS](/packages/typisttech-php-matrix/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (35)Used By (0)

PHP Matrix
==========

[](#php-matrix)

[![GitHub Release](https://camo.githubusercontent.com/68bc1ebe9743382fc4804b88921694b1663dffce145d592b0983d6ad8797389b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f747970697374746563682f7068702d6d6174726978)](https://github.com/typisttech/php-matrix/releases)[![Test](https://github.com/typisttech/php-matrix/actions/workflows/test.yml/badge.svg)](https://github.com/typisttech/php-matrix/actions/workflows/test.yml)[![codecov](https://camo.githubusercontent.com/770106f59635120a6544623dbd80b961ceb6e6abae61bd6fb5af89891143bc1b/68747470733a2f2f636f6465636f762e696f2f67682f747970697374746563682f7068702d6d61747269782f67726170682f62616467652e7376673f746f6b656e3d48563555444c504d4d51)](https://codecov.io/gh/typisttech/php-matrix)[![License](https://camo.githubusercontent.com/8915e4ebca38b1449fef30ddcd9dd240cdd603ce6f0f8aaa0feebf65cbe2a7c4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f747970697374746563682f7068702d6d61747269782e737667)](https://github.com/typisttech/php-matrix/blob/master/LICENSE)[![Follow @TangRufus on X](https://camo.githubusercontent.com/7415ea9d2391e64fc2a35887d01d58c13cac70988c9ecc62b57bc7fee6104de5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f466f6c6c6f772d54616e6752756675732d3135323032423f6c6f676f3d78266c6f676f436f6c6f723d7768697465)](https://x.com/tangrufus)[![Follow @TangRufus.com on Bluesky](https://camo.githubusercontent.com/6d838460816d5ab6e0e1f911a11f2731f12f3538761d12b8638f32861fcf2e1a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f426c7565736b792d54616e6752756675732e636f6d2d626c75653f6c6f676f3d626c7565736b79)](https://bsky.app/profile/tangrufus.com)[![Sponsor @TangRufus via GitHub](https://camo.githubusercontent.com/49753abc8cb53b971b0e46dec52e9ed32eaebf73be15ce3963306559a3ec7ccb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53706f6e736f722d54616e6752756675732d4541344141413f6c6f676f3d67697468756273706f6e736f7273)](https://github.com/sponsors/tangrufus)[![Hire Typist Tech](https://camo.githubusercontent.com/13f50b9bd2301613833b4f0ac55700b2f1c297c0fff7ba45a2a98b6c938a18db/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f486972652d547970697374253230546563682d373738383939)](https://typist.tech/contact/)

 **List PHP versions that satisfy the required PHP constraint in `composer.json`.**

 Built with ♥ by [Typist Tech](https://typist.tech/)

---

Tip

**Hire Tang Rufus!**

I am looking for my next role, freelance or full-time. If you find this tool useful, I can build you more weird stuff like this. Let's talk if you are hiring PHP / Ruby / Go developers.

Contact me at

---

Usage
-----

[](#usage)

### GitHub Actions

[](#github-actions)

For generating PHP version matrix in GitHub Actions, use [PHP Matrix Action](https://github.com/marketplace/actions/php-matrix).

Example```
name: Test

on:
  push:

jobs:
  php-matrix:
    runs-on: ubuntu-latest
    outputs:
      versions: ${{ steps.php-matrix.outputs.versions }}
    steps:
      - uses: actions/checkout@v5
        with:
          sparse-checkout: composer.json
          sparse-checkout-cone-mode: false

      - uses: typisttech/php-matrix-action@v2
        id: php-matrix

  test:
    runs-on: ubuntu-latest
    needs: php-matrix
    strategy:
      matrix:
        php-version: ${{ fromJSON(needs.php-matrix.outputs.versions) }}
    steps:
      - uses: actions/checkout@v5
      - uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php-version }}
      - run: composer install
      - run: composer test
```

### List PHP versions that satisfy the required PHP constraint in `composer.json`

[](#list-php-versions-that-satisfy-the-required-php-constraint-in-composerjson)

```
$ cat ./composer.json
{"require":{"php":"^7 || ^8"}}

$ php-matrix composer
{
    "constraint": "^7 || ^8",
    "versions": [
        "7.0",
        "7.1",
        "7.2",
        "7.3",
        "7.4",
        "8.0",
        "8.1",
        "8.2",
        "8.3",
        "8.4"
    ],
    "lowest": "7.0",
    "highest": "8.4"
}
```

```
$ cat ./some/path/to/the.json
{"require":{"php":"~7.4.29 || ~8.1.29"}}

$ php-matrix composer --source=php.net --mode=full ./some/path/to/the.json
{
    "constraint": "~7.4.29 || ~8.1.29",
    "versions": [
        "7.4.29",
        "7.4.30",
        "7.4.32",
        "7.4.33",
        "8.1.29",
        "8.1.30",
        "8.1.31",
        "8.1.32",
        "8.1.33"
    ],
    "lowest": "7.4.29",
    "highest": "8.1.33"
}
```

```
$ php-matrix composer --help
Description:
  List PHP versions that satisfy the required PHP constraint in composer.json

Usage:
  composer [options] [--] []

Arguments:
  path                  Path to composer.json file. [default: "./composer.json"]

Options:
      --source=SOURCE   Available sources:
                        - auto: Use offline in minor-only mode. Otherwise, fetch from php.net
                        - php.net: Fetch releases information from php.net
                        - offline: Use hardcoded releases information
                         [default: "auto"]
      --mode=MODE       Available modes:
                        - full: Report all satisfying versions in MAJOR.MINOR.PATCH format
                        - minor-only: Report MAJOR.MINOR versions only
                         [default: "minor-only"]
  -h, --help            Display help for the given command. When no command is given display help for the list command
      --silent          Do not output any message
  -q, --quiet           Only errors are displayed. All other output is suppressed
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
```

### List PHP versions that satisfy the given constraint

[](#list-php-versions-that-satisfy-the-given-constraint)

```
$ php-matrix constraint '^7 || ^8'
{
    "constraint": "^7 || ^8",
    "versions": [
        "7.0",
        "7.1",
        "7.2",
        "7.3",
        "7.4",
        "8.0",
        "8.1",
        "8.2",
        "8.3",
        "8.4"
    ],
    "lowest": "7.0",
    "highest": "8.4"
}
```

```
$ php-matrix constraint --source=php.net --mode=full '~7.4.29 || ~8.1.29'
{
    "constraint": "~7.4.29 || ~8.1.29",
    "versions": [
        "7.4.29",
        "7.4.30",
        "7.4.32",
        "7.4.33",
        "8.1.29",
        "8.1.30",
        "8.1.31",
        "8.1.32",
        "8.1.33"
    ],
    "lowest": "7.4.29",
    "highest": "8.1.33"
}
```

```
$ php-matrix constraint --help
Description:
  List PHP versions that satisfy the given constraint

Usage:
  constraint [options] [--]

Arguments:
  constraint            The version constraint.

Options:
      --source=SOURCE   Available sources:
                        - auto: Use offline in minor-only mode. Otherwise, fetch from php.net
                        - php.net: Fetch releases information from php.net
                        - offline: Use hardcoded releases information
                         [default: "auto"]
      --mode=MODE       Available modes:
                        - full: Report all satisfying versions in MAJOR.MINOR.PATCH format
                        - minor-only: Report MAJOR.MINOR versions only
                         [default: "minor-only"]
  -h, --help            Display help for the given command. When no command is given display help for the list command
      --silent          Do not output any message
  -q, --quiet           Only errors are displayed. All other output is suppressed
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
```

### Options

[](#options)

#### `--mode`

[](#--mode)

Available modes:

- `minor-only` *(default)*: Report `MAJOR.MINOR` versions only
- `full`: Report all satisfying versions in `MAJOR.MINOR.PATCH` format

#### `--source`

[](#--source)

Available sources:

- `auto` *(default)*: Use `offline` in `minor-only` mode. Otherwise, fetch from [php.net](https://www.php.net/releases/index.php)
- `php.net`: Fetch releases information from [php.net](https://www.php.net/releases/index.php)
- `offline`: Use [hardcoded releases](./data/all-versions.json) information

Tip

**Hire Tang Rufus!**

There is no need to understand any of these quirks. Let me handle them for you. I am seeking my next job, freelance or full-time.

If you are hiring PHP / Ruby / Go developers, contact me at

### Dump Shell Completion Scripts

[](#dump-shell-completion-scripts)

For shell completions, follow the instructions from:

```
$ php-matrix completion --help
```

If you installed `PHP Matrix` [via Homebrew](#homebrew-macos--linux-recommended), completion scripts are managed by Homebrew. Read more at

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

[](#installation)

### Homebrew (macOS / Linux) (Recommended)

[](#homebrew-macos--linux-recommended)

```
brew tap typisttech/tap
brew install typisttech/tap/php-matrix
```

### `apt-get` (Debian based distributions, for example: Ubuntu)

[](#apt-get-debian-based-distributions-for-example-ubuntu)

```
curl -1sLf 'https://dl.cloudsmith.io/public/typisttech/oss/setup.deb.sh' | sudo -E bash
sudo apt-get install php-matrix
```

Instead of the automatic setup script, you can manually configure the repository with the instructions on [Cloudsmith](https://cloudsmith.io/~typisttech/repos/oss/setup/#formats-deb).

### Manual `.deb` (Debian based distributions, for example: Ubuntu)

[](#manual-deb-debian-based-distributions-for-example-ubuntu)

Warning

If you install the `.deb` file manually, you have to take care of updating it by yourself.

Download the latest `.deb` file from [GitHub Releases](https://github.com/typisttech/php-matrix/releases/latest), or via [`gh`](https://cli.github.com/):

```
# Both arm64 (aarch64) and amd64 (x86_64) architectures are available.
gh release download --repo 'typisttech/php-matrix' --pattern 'php-matrix_linux_arm64.deb'
```

**Optionally**, verify the `.deb` file:

```
gh attestation verify --repo 'typisttech/php-matrix' 'php-matrix_linux_arm64.deb'
```

Finally, install the package:

```
sudo dpkg -i php-matrix_linux_arm64.deb
```

Manual Binary
-------------

[](#manual-binary)

Warning

If you install the binary manually, you have to take care of updating it by yourself.

Download the latest `.tar.gz` file from [GitHub Releases](https://github.com/typisttech/php-matrix/releases/latest), or via [`gh`](https://cli.github.com/):

```
# Both darwin (macOS) and linux operating systems are available.
# Both arm64 (aarch64) and amd64 (x86_64) architectures are available.
gh release download --repo 'typisttech/php-matrix' --pattern 'php-matrix_darwin_arm64.tar.gz'
```

**Optionally**, verify the `.tar.gz` file:

```
gh attestation verify --repo 'typisttech/php-matrix' 'php-matrix_darwin_arm64.tar.gz'
```

Finally, unarchive and move the binary into `$PATH`:

```
tar -xvf 'php-matrix_darwin_arm64.tar.gz'

# Or, move it to any directory under `$PATH`
mv php-matrix /usr/local/bin
```

Credits
-------

[](#credits)

[`PHP Matrix`](https://github.com/typisttech/php-matrix) is a [Typist Tech](https://typist.tech) project and maintained by [Tang Rufus](https://x.com/TangRufus), freelance developer [for hire](https://typist.tech/contact/).

Full list of contributors can be found [on GitHub](https://github.com/typisttech/php-matrix/graphs/contributors).

Copyright and License
---------------------

[](#copyright-and-license)

This project is a [free software](https://www.gnu.org/philosophy/free-sw.en.html) distributed under the terms of the MIT license. For the full license, see [LICENSE](./LICENSE).

Contribute
----------

[](#contribute)

Feedbacks / bug reports / pull requests are welcome.

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance87

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 51.7% 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 ~19 days

Total

23

Last Release

92d ago

Major Versions

v0.2.7 → v1.0.02025-10-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/c1b05c8ed4ea3f68173555264d0226d5faeb7f315ed9df91890c351ef576ce72?d=identicon)[TangRufus](/maintainers/TangRufus)

---

Top Contributors

[![tangrufus](https://avatars.githubusercontent.com/u/2259834?v=4)](https://github.com/tangrufus "tangrufus (61 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (35 commits)")[![tastendruck[bot]](https://avatars.githubusercontent.com/u/25708257?v=4)](https://github.com/tastendruck[bot] "tastendruck[bot] (21 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (1 commits)")

---

Tags

clicomposerphpversionphpcomposercliversion

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/typisttech-php-matrix/health.svg)

```
[![Health](https://phpackages.com/badges/typisttech-php-matrix/health.svg)](https://phpackages.com/packages/typisttech-php-matrix)
```

###  Alternatives

[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19562.3M1.3k](/packages/drupal-core)[laminas/laminas-cli

Command-line interface for Laminas projects

563.7M54](/packages/laminas-laminas-cli)[mahocommerce/maho

Free and open source ecommerce platform, created in 2024 on the M1 platform, PHP 8.3+

1322.1k12](/packages/mahocommerce-maho)

PHPackages © 2026

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