Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
code

GitHub Action

Setup PHP environment

v4.0.1

Setup PHP environment

code

Setup PHP environment

Setup a PHP environment and add it to the PATH, additionally providing proxy support

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Setup PHP environment

uses: nanasess/setup-php@v4.0.1

Learn more about this action in nanasess/setup-php

Choose a version

setup-php

GitHub Actions status LICENSE PHP Versions Supported

This action sets up a PHP environment for use in actions by:

  • optionally installing a version of PHP and adding to PATH.
  • registering problem matchers for error output

PHP version support

  • 5.4(Ubuntu only)
  • 5.5
  • 5.6
  • 7.0
  • 7.1
  • 7.2
  • 7.3
  • 7.4
  • 8.0
  • 8.1
  • 8.2
  • 8.3

Patch version can also be set. e.g. 7.2.11

OS/Platform support

  • ubuntu-latest, ubuntu-22.04 or ubuntu-20.04
  • windows-latest, windows-2022 or windows-2019

Usage

See action.yml

Basic:

steps:
- uses: actions/checkout@v3
- uses: nanasess/setup-php@v4
  with:
    php-version: '8.2'
- run: php my_script.php

Matrix Testing:

jobs:
  build:
    runs-on: ${{ matrix.operating-system }}
    strategy:
      matrix:
        operating-system: [ ubuntu-latest, windows-latest ]
        php: [ '5.4', '5.5', '5.6', '7.1', '7.2', '7.3', '7.4', '7.3.3' ]
    name: PHP ${{ matrix.php }} sample
    steps:
      - uses: actions/checkout@v3
      - name: Setup PHP
        uses: nanasess/setup-php@v4
        with:
          php-version: ${{ matrix.php }}
      - run: php my_script.php

License

The scripts and documentation in this project are released under the MIT License

Contributions

Contributions are welcome! See Contributor's Guide