Thanks to visit codestin.com
Credit goes to github.com

Skip to content

WyriHaximus/github-action-composer-php-versions-in-range

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Composer PHP Versions in range

GitHub Action that gets the PHP versions in range from composer.json

Options

This action supports the following option.

upcomingReleases

Will include the next upcoming major or minor PHP release. Looking for more bleeding edge, nightly will hold the same value from the release day of the previous X.Y.0 release. Currently, that is nothing.

  • Required: No
  • Type: Boolean
  • Default: false
  • Example: true for including upcoming new major or minor releases

nightly

Will include the nightly of the next new major or minor PHP release. Currently, that is : 8.5.

  • Required: No
  • Type: Boolean
  • Default: false
  • Example: true for including the nightly of the next new major or minor releases

workingDirectory

Set a different than the root directory to look for composer.json

  • Required: No
  • Type: String
  • Default: ""
  • Example: clients/GitHub

The nightly and upcomingReleases change depending on how close we are to the next release.

Input Current value Gets updated
nightly 8.5 When the first nightly of the next major/minor PHP version is out
upcomingReleases When the first image of the next major/minor PHP version is out through https://github.com/WyriHaximusNet/docker-php

Output

The action comes with 7 outputs, most importantly version which contains a JSON list with versions to be used in follow up steps:

["7.3","7.4","8.0","8.1","8.2","8.3","8.4"]

And the highest and lowest outputs that provide the highest PHP version (8.4 in the version output example) and the lowest PHP version (7.3 in the version output example) from the version list. The 4rth output is upcoming and will be populated with the upcoming but in alpha/beta/rc next minor or major version of PHP. The nightly contains the current in development but not alpha/beta/rc tag next major or minor version.

On top of that this action will also give you 3 lists of extensions. The extensions from require in requiredExtensions, dev extensions in requiredDevExtensions, and a combined list in extensions.

Example

This example will get the supported PHP version from composer.json and run tests of all those version:

name: CI

on:
  push:
  pull_request:

jobs:
  supported-versions-matrix:
    name: Supported Versions Matrix
    runs-on: ubuntu-latest
    outputs:
      extensions: ${{ steps.supported-versions-matrix.outputs.extensions }}
      version: ${{ steps.supported-versions-matrix.outputs.version }}
    steps:
      - uses: actions/checkout@v3
      - id: supported-versions-matrix
        uses: WyriHaximus/github-action-composer-php-versions-in-range@v1
  tests:
    name: PHP ${{ matrix.php }} Latest
    runs-on: ubuntu-latest
    needs:
      - supported-versions-matrix
    strategy:
      matrix:
        php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }}
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
          tools: composer
          coverage: none
          extensions: ${{ join(fromJson(needs.supported-versions-matrix.outputs.extensions), ',') }}
      - name: Install dependencies
        uses: ramsey/composer-install@v2
      - name: Execute tests
        run: composer test

License

Copyright 2026 Cees-Jan Kiewiet

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

GitHub Action that gets the PHP versions in range from composer.json

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Contributors