typisttech / php-matrix
List PHP versions that satisfy the required PHP constraint in composer.json.
Requires
- php: ^8.5
- composer-runtime-api: ^2.2
- composer/semver: ^3.4
- guzzlehttp/guzzle: ^7.10
- symfony/console: ^8.1
- symfony/polyfill-iconv: ^1.33
Requires (Dev)
- laravel/pao: ^1.1
- mockery/mockery: ^1.6
- pestphp/pest: ^4.1
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.1
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpstan/phpstan-symfony: ^2.0
This package is auto-updated.
Last update: 2026-06-26 17:01:14 UTC
README
PHP Matrix
List PHP versions that satisfy the required PHP constraint in composer.json.
Built with ♥ by 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 https://typist.tech/contact/
GitHub Actions Usage
For generating PHP version matrix in GitHub Actions, use PHP Matrix Action.
Example
name: Test on: push: jobs: php-matrix: runs-on: ubuntu-latest outputs: versions: ${{ steps.php-matrix.outputs.versions }} steps: - uses: actions/checkout@v7 with: sparse-checkout: composer.json sparse-checkout-cone-mode: false - uses: typisttech/php-matrix-action@v3 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@v7 - uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} - run: composer install - run: composer test
CLI Usage
List PHP versions that satisfy the required PHP constraint in composer.json
$ 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] [--] [<path>] 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
$ 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] [--] <constraint> 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
--mode
Available modes:
minor-only(default): ReportMAJOR.MINORversions onlyfull: Report all satisfying versions inMAJOR.MINOR.PATCHformat
--source
Available sources:
auto(default): Useofflineinminor-onlymode. Otherwise, fetch from php.netphp.net: Fetch releases information from php.netoffline: Use hardcoded releases 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 https://typist.tech/contact/
Dump Shell Completion Scripts
For shell completions, follow the instructions from:
$ php-matrix completion --help
If you installed PHP Matrix via Homebrew, completion scripts are managed by Homebrew.
Read more at https://docs.brew.sh/Shell-Completion
Installation
Homebrew (macOS / Linux) (Recommended)
brew install typisttech/tap/php-matrix
Linux (Debian & Alpine)
Follow the instructions on https://broadcasts.cloudsmith.com/typisttech/oss
Package repository hosting is graciously provided by Cloudsmith. Cloudsmith is the only fully hosted, cloud-native, universal package management solution, that enables your organization to create, store and share packages in any format, to any place, with total confidence.
Pre-built .deb & .apk
Warning
If you install the .deb or .apk file manually, you have to updating them manually.
Download the latest .deb or .apk file from GitHub Releases, or via gh.
Then, install it via dpkg -install or apk add.
Pre-built Binaries
Warning
If you install the binaries manually, you have to updating them manually.
Download the latest .tar.gz file from GitHub Releases, or via gh.
Then, unarchive and move the binary into $PATH.
People Also Use
- PHP Matrix Action
Generate PHP version matrix according to
composer.jsonfor GitHub Actions - Composer Audit to SARIF Action Convert Composer audit reports to SARIF files in GitHub Actions
- WP Sec Adv Composer repository for WordPress security advisories
- WP Org Closed Plugin Composer plugin to mark packages as abandoned if closed on WordPress.org
Credits
PHP Matrix is a Typist Tech project and maintained by Tang Rufus, freelance developer for hire.
Full list of contributors can be found on GitHub.
Copyright and License
This project is a free software distributed under the terms of the MIT license. For the full license, see LICENSE.
Contribute
Feedbacks / bug reports / pull requests are welcome.