定制 typisttech/php-matrix 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

typisttech/php-matrix

Composer 安装命令:

composer create-project typisttech/php-matrix

包简介

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

README 文档

README

PHP Matrix

GitHub Release Test codecov License Follow @TangRufus on X Follow @TangRufus.com on Bluesky Sponsor @TangRufus via GitHub Hire Typist Tech

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): Report MAJOR.MINOR versions only
  • full: Report all satisfying versions in MAJOR.MINOR.PATCH format

--source

Available sources:

  • auto (default): Use offline in minor-only mode. Otherwise, fetch from php.net
  • php.net: Fetch releases information from php.net
  • offline: 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

Cloudsmith

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

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.

typisttech/php-matrix 适用场景与选型建议

typisttech/php-matrix 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.44k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 12 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「cli」 「composer」 「version」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 typisttech/php-matrix 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 typisttech/php-matrix 我们能提供哪些服务?
定制开发 / 二次开发

基于 typisttech/php-matrix 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 8.44k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 15
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-14