GitHub action to set up PHP with extensions, php.ini configuration, coverage drivers, and various tools.

Overview

Setup PHP in GitHub Actions

Setup PHP in GitHub Actions

GitHub Actions status Codecov Code Coverage LICENSE PHP Versions Supported

setup-php reddit setup-php twitter setup-php status

Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer in GitHub Actions. This action gives you a cross platform interface to set up the PHP environment you need to test your application. Refer to Usage section and examples to see how to use this.

Contents

☁️ OS/Platform Support

Both GitHub-hosted and self-hosted runners are suppported by setup-php on the following OS/Platforms.

GitHub-Hosted Runners

Virtual environment YAML workflow label Pre-installed PHP
Ubuntu 18.04 ubuntu-18.04 PHP 7.1 to PHP 8.0
Ubuntu 20.04 ubuntu-latest or ubuntu-20.04 PHP 7.4 to PHP 8.0
Windows Server 2019 windows-latest or windows-2019 PHP 8.0
Windows Server 2022 windows-2022 PHP 8.0
macOS Catalina 10.15 macos-latest or macos-10.15 PHP 8.0
macOS Big Sur 11.x macos-11 PHP 8.0

Self-Hosted Runners

Host OS/Virtual environment YAML workflow label
Ubuntu 18.04 self-hosted or Linux
Ubuntu 20.04 self-hosted or Linux
Ubuntu 21.04 self-hosted or Linux
Debian 9 self-hosted or Linux
Debian 10 self-hosted or Linux
Debian 11 self-hosted or Linux
Windows 7 and newer self-hosted or Windows
Windows Server 2012 R2 and newer self-hosted or Windows
macOS Catalina 10.15 self-hosted or macOS
macOS Big Sur 11.x x86_64/arm64 self-hosted or macOS
  • Refer to the self-hosted setup to use the action on self-hosted runners.
  • Operating systems based on the above Ubuntu and Debian versions are also supported on a best effort basis.
  • If the requested PHP version is pre-installed, setup-php switches to it, otherwise it installs the PHP version.

🎉 PHP Support

On all supported OS/Platforms the following PHP versions are supported as per the runner.

  • PHP 5.3 to PHP 8.2 on GitHub-hosted runners.
  • PHP 5.6 to PHP 8.2 on self-hosted runners.
PHP Version Stability Release Support Runner Support
5.3 Stable End of life GitHub-hosted
5.4 Stable End of life GitHub-hosted
5.5 Stable End of life GitHub-hosted
5.6 Stable End of life GitHub-hosted, self-hosted
7.0 Stable End of life GitHub-hosted, self-hosted
7.1 Stable End of life GitHub-hosted, self-hosted
7.2 Stable End of life GitHub-hosted, self-hosted
7.3 Stable Security fixes only GitHub-hosted, self-hosted
7.4 Stable Active GitHub-hosted, self-hosted
8.0 Stable Active GitHub-hosted, self-hosted
8.1 Nightly In development GitHub-hosted, self-hosted
8.2 Nightly In development GitHub-hosted, self-hosted

Notes:

  • Specifying 8.1 and 8.2 in php-version input installs a nightly build of PHP 8.1.0-dev and PHP 8.2.0-dev respectively. See nightly build setup for more information.
  • To use JIT on PHP 8.0 and above, refer to the JIT configuration section.

PHP Extension Support

PHP extensions can be set up using the extensions input. It accepts a string in csv-format.

  • On Ubuntu, extensions which are available as a package, available on PECL or a git repository can be set up.
- name: Setup PHP with PECL extension
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
    extensions: imagick, swoole
  • On Windows, extensions available on PECL which have the DLL binary can be set up.

  • On macOS, extensions available on PECL or a git repository can be set up.

  • On Ubuntu and macOS to compile and install an extension from a git repository follow this guide.

  • Extensions installed along with PHP if specified are enabled.

  • Specific versions of extensions available on PECL can be set up by suffixing the extension's name with the version. This is useful for installing old versions of extensions which support end of life PHP versions.

- name: Setup PHP with specific version of PECL extension
  uses: shivammathur/setup-php@v2
  with:
    php-version: '5.4'
    extensions: swoole-1.9.3
  • Pre-release versions extensions available on PECL can be set up by suffixing the extension's name with its state i.e alpha, beta, devel or snapshot.
- name: Setup PHP with pre-release PECL extension
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
    extensions: xdebug-beta
  • Shared extensions can be disabled by prefixing them with a :. All extensions depending on the specified extension will also be disabled.
- name: Setup PHP and disable opcache
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
    extensions: :opcache
  • All shared extensions can be disabled by specifying none. When none is specified along with other extensions, it is hoisted to the start of the input. So, all the shared extensions will be disabled first, then rest of the extensions in the input will be processed.

Note: This disables all core and third-party shared extensions and thus, can break some tools which need them. So, make sure you add the required extensions after none in the extensions input.

- name: Setup PHP without any shared extensions except mbstring
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
    extensions: none, mbstring
  • Extension intl can be set up with specific ICU version for PHP 5.6 and above in Ubuntu workflows by suffixing intl with the ICU version. ICU 50.2 and newer versions are supported. Refer to ICU builds for the specific versions supported.
- name: Setup PHP with intl
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
    extensions: intl-69.1
  • Extensions loaded by default after setup-php runs can be found on the wiki.

  • These extensions have custom support:

    • cubrid, pdo_cubrid and gearman on Ubuntu.
    • geos on Ubuntu and macOS.
    • blackfire, couchbase, ioncube, oci8, pdo_firebird, pdo_oci, pecl_http, phalcon3 and phalcon4 on all supported OS.
  • By default, extensions which cannot be added or disabled gracefully leave an error message in the logs, the action is not interrupted. To change this behaviour you can set fail-fast flag to true.

- name: Setup PHP with fail-fast
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
    extensions: oci8
  env:
    fail-fast: true

🔧 Tools Support

These tools can be set up globally using the tools input. It accepts a string in csv-format.

behat, blackfire, blackfire-player, codeception, composer, composer-normalize, composer-prefetcher, composer-require-checker, composer-unused, cs2pr, deployer, flex, grpc_php_plugin, infection, parallel-lint, pecl, phan, phing, phinx, phive, php-config, php-cs-fixer, phpcbf, phpcpd, phpcs, phpdoc or phpDocumentor, phpize, phplint, phpmd, phpspec, phpstan, phpunit, phpunit-bridge, phpunit-polyfills, prestissimo, protoc, psalm, symfony or symfony-cli, vapor or vapor-cli, wp or wp-cli

- name: Setup PHP with tools
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
    tools: php-cs-fixer, phpunit
  • In addition to above tools any composer tool or package can also be set up globally by specifying it as vendor/package matching the listing on Packagist. This format accepts the same version constraints as composer.
- name: Setup PHP with tools
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
    tools: vimeo/psalm
  • To set up a particular version of a tool, specify it in the form tool:version.

    Version can be in the following format:

    • Semver. For example tool:1.2.3 or tool:1.2.3-beta1.
    • Major version. For example tool:1 or tool:1.x.
    • Major and minor version. For example tool:1.2 or tool:1.2.x.

    When you specify just the major version or the version in major.minor format, the latest patch version matching the input will be setup.

    Except for major versions of composer, For other tools when you specify only the major version or the version in major.minor format for any tool you can get rate limited by GitHub's API. To avoid this, it is recommended to provide a GitHub OAuth token. You can do that by setting COMPOSER_TOKEN environment variable.

- name: Setup PHP with tools
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
    tools: php-cs-fixer:3, phpunit:8.5
  env:
    COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  • The latest stable version of composer is set up by default. You can set up the required composer version by specifying the major version v1 or v2, or the version in major.minor or semver format, Additionally for composer snapshot and preview can also be specified to set up the respective releases.
- name: Setup PHP with composer v2
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
    tools: composer:v2
  • If you do not use composer in your workflow, you can specify tools: none to skip it.
- name: Setup PHP without composer
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
    tools: none
  • Scripts phpize and php-config are set up with the same version as of the input PHP version.

  • The latest version of blackfire cli is set up when blackfire is specified in tools input. Please refer to the official documentation for using blackfire with GitHub Actions.

  • Tools prestissimo and composer-prefetcher will be skipped unless composer:v1 is also specified in tools input. It is recommended to drop prestissimo and use composer v2.

  • By default, tools which cannot be set up gracefully leave an error message in the logs, the action is not interrupted. To change this behaviour you can set fail-fast flag to true.

- name: Setup PHP with fail-fast
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
    tools: deployer
  env:
    fail-fast: true

Notes

  • Input tools is useful to set up tools which you only use in GitHub Actions, thus keeping your composer.json tidy.
  • If you do not want to use all your dev-dependencies in GitHub Actions workflow, you can run composer with --no-dev and install required tools using tools input to speed up your workflow.
  • If you have a tool in your composer.json, do not set up it with tools input as the two instances of the tool might conflict.

📶 Coverage Support

Xdebug

Specify coverage: xdebug to use Xdebug and disable PCOV.
Runs on all PHP versions supported.

- name: Setup PHP with Xdebug
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
    coverage: xdebug
  • The latest version of Xdebug compatible with the PHP version is set up by default.
  • If you need Xdebug 2.x on PHP 7.2, 7.3 or 7.4, you can specify coverage: xdebug2.
- name: Setup PHP with Xdebug 2.x
  uses: shivammathur/setup-php@v2
  with:
    php-version: '7.4'
    coverage: xdebug2

PCOV

Specify coverage: pcov to use PCOV and disable Xdebug.
Runs on PHP 7.1 and newer PHP versions.

  • If your source code directory is other than src, lib or, app, specify pcov.directory using the ini-values input.
- name: Setup PHP with PCOV
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
    ini-values: pcov.directory=api #optional, see above for usage.
    coverage: pcov
  • PHPUnit 8.x and above supports PCOV out of the box.
  • If you are using PHPUnit 5.x, 6.x or 7.x, you need to set up pcov/clobber before executing your tests.
- name: Setup PCOV
  run: |
    composer require pcov/clobber
    vendor/bin/pcov clobber

Disable Coverage

Specify coverage: none to disable both Xdebug and PCOV.

Disable coverage for these reasons:

  • You are not generating coverage reports while testing.
  • It will disable Xdebug, which will have a positive impact on PHP performance.
  • You are using phpdbg for running your tests.
  • You are profiling your code using blackfire.
  • You are using PHP in JIT mode. Please refer to JIT configuration section for more details.
- name: Setup PHP with no coverage driver
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
    coverage: none

📝 Usage

Inputs

Specify using with keyword

php-version (required)

  • Specify the PHP version you want to set up.
  • Accepts a string. For example '8.0'.
  • Accepts latest to set up the latest stable PHP version.
  • Accepts nightly to set up a nightly build from the master branch of PHP.
  • Accepts the format d.x, where d is the major version. For example 5.x, 7.x and 8.x.
  • See PHP support for supported PHP versions.

extensions (optional)

  • Specify the extensions you want to add or disable.
  • Accepts a string in csv-format. For example mbstring, :opcache.
  • Accepts none to disable all shared extensions.
  • Shared extensions prefixed with : are disabled.
  • See PHP extension support for more info.

ini-values (optional)

  • Specify the values you want to add to php.ini.
  • Accepts a string in csv-format. For example post_max_size=256M, max_execution_time=180.
  • Accepts ini values with commas if wrapped in quotes. For example xdebug.mode="develop,coverage".

coverage (optional)

  • Specify the code-coverage driver you want to set up.
  • Accepts xdebug, pcov or none.
  • See coverage support for more info.

tools (optional)

  • Specify the tools you want to set up.
  • Accepts a string in csv-format. For example: phpunit, phpcs
  • See tools Support for tools supported.

Outputs

php-version

To use outputs, give the setup-php step an id, you can use the same to get the outputs in a later step.

  • Provides the PHP version in semver format.
- name: Setup PHP
  id: setup-php
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'

- name: Print PHP version
  run: echo ${{ steps.setup-php.outputs.php-version }}

Flags

Specify using env keyword

fail-fast (optional)

  • Specify to mark the workflow as failed if an extension or tool fails to set up.
  • This changes the default mode from graceful warnings to fail-fast.
  • By default, it is set to false.
  • Accepts true and false.

phpts (optional)

  • Specify to set up thread-safe version of PHP on Windows.
  • Accepts ts and nts.
  • By default, it is set to nts.
  • See thread safe setup for more info.

update (optional)

  • Specify to update PHP on the runner to the latest patch version.
  • Accepts true and false.
  • By default, it is set to false.
  • See force update setup for more info.

See below for more info.

Basic Setup

Setup a particular PHP version.

steps:
- name: Setup PHP
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
    extensions: mbstring, intl
    ini-values: post_max_size=256M, max_execution_time=180
    coverage: xdebug
    tools: php-cs-fixer, phpunit

Matrix Setup

Setup multiple PHP versions on multiple operating systems.

jobs:
  run:
    runs-on: ${{ matrix.operating-system }}
    strategy:
      matrix:
        operating-system: ['ubuntu-latest', 'windows-latest', 'macos-latest']
        php-versions: ['7.3', '7.4', '8.0']
        phpunit-versions: ['latest']
        include:
        - operating-system: 'ubuntu-latest'
          php-versions: '7.2'
          phpunit-versions: '8.5.21'
    steps:
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: ${{ matrix.php-versions }}
        extensions: mbstring, intl
        ini-values: post_max_size=256M, max_execution_time=180
        coverage: xdebug
        tools: php-cs-fixer, phpunit:${{ matrix.phpunit-versions }}

Nightly Build Setup

Setup a nightly build of PHP 8.1 or PHP 8.2.

  • This version is currently in development.
  • Some user space extensions might not support this version currently.
steps:
- name: Setup nightly PHP
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.1'
    extensions: mbstring
    ini-values: post_max_size=256M, max_execution_time=180
    coverage: xdebug
    tools: php-cs-fixer, phpunit

Thread Safe Setup

Setup TS or NTS PHP on Windows.

  • NTS versions are set up by default.
  • On Ubuntu and macOS only NTS versions are supported.
  • On Windows both TS and NTS versions are supported.
jobs:
  run:
    runs-on: windows-latest
    name: Setup PHP TS on Windows
    steps:
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.0'
      env:
        phpts: ts # specify ts or nts

Force Update Setup

Update to the latest patch of PHP versions.

  • Pre-installed PHP versions on the GitHub Actions images are not updated to their latest patch release by default.
  • You can specify the update environment variable to true for updating to the latest release.
- name: Setup PHP with latest versions
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
  env:
    update: true # specify true or false

Verbose Setup

Debug your workflow

To debug any issues, you can use the verbose tag instead of v2.

- name: Setup PHP with logs
  uses: shivammathur/setup-php@verbose
  with:
    php-version: '8.0'

Multi-Arch Setup

Setup PHP on multiple architecture on Ubuntu GitHub Runners.

  • PHP 5.6 to PHP 8.0 are supported by setup-php on multiple architecture on Ubuntu.
  • For this, you can use shivammathur/node images as containers. These have compatible Nodejs installed for JavaScript based GitHub Actions.
  • Currently, for ARM based setup, you will need self-hosted runners.
jobs:
  run:
    runs-on: ubuntu-latest
    container: shivammathur/node:latest-${{ matrix.arch }}
    strategy:
      matrix:
        arch: ["amd64", "i386"]
    steps:
      - name: Install PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.0'

Self Hosted Setup

Setup PHP on a self-hosted runner.

  • To set up a containerised self-hosted runner, refer to the following guides as per your base operating system.

  • To set up the runner directly on the host OS or in a virtual machine, follow this requirements guide before setting up the self-hosted runner.

  • If your workflow uses service containers, then set up the runner on a Linux host or in a Linux virtual machine. GitHub Actions does not support nested virtualization on Linux, so services will not work in a dockerized container.

Specify the environment variable runner with the value self-hosted. Without this your workflow will fail.

jobs:
  run:
    runs-on: self-hosted
    strategy:
      matrix:
        php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
    name: PHP ${{ matrix.php-versions }}
    steps:
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: ${{ matrix.php-versions }}
      env:
        runner: self-hosted # Specify the runner.

Notes

  • Do not set up multiple self-hosted runners on a single server instance as parallel workflow will conflict with each other.
  • Do not set up self-hosted runners on the side on your development environment or your production server.
  • Avoid using the same labels for your self-hosted runners which are used by GitHub-hosted runners.

Local Testing Setup

Test your Ubuntu workflow locally using nektos/act.

jobs:
  run:
    runs-on: ubuntu-latest
    steps:
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.0'

Run the workflow locally with act using shivammathur/node docker images.

Choose the image tag which matches the runs-on property in your workflow. For example, if you are using ubuntu-20.04 in your workflow, run act -P ubuntu-20.04=shivammathur/node:20.04.

# For runs-on: ubuntu-latest
act -P ubuntu-latest=shivammathur/node:latest

# For runs-on: ubuntu-20.04
act -P ubuntu-20.04=shivammathur/node:2004

# For runs-on: ubuntu-18.04
act -P ubuntu-18.04=shivammathur/node:1804

JIT Configuration

Enable Just-in-time(JIT) on PHP 8.0 and above.

  • To enable JIT, enable opcache in cli mode by setting opcache.enable_cli=1.
  • JIT conflicts with Xdebug, PCOV, and other extensions which override zend_execute_ex function, so set coverage: none and disable any such extension if added.
  • By default, opcache.jit=1235 and opcache.jit_buffer_size=256M are set which can be changed using ini-values input.
  • For detailed information about JIT related directives refer to the official PHP documentation.

For example to enable JIT in tracing mode with buffer size of 64 MB.

- name: Setup PHP with JIT in tracing mode
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
    coverage: none
    ini-values: opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=64M

Cache Extensions

You can cache PHP extensions using shivammathur/cache-extensions and action/cache GitHub Actions. Extensions which take very long to set up when cached are available in the next workflow run and are enabled directly. This reduces the workflow execution time.
Refer to shivammathur/cache-extensions for details.

Cache Composer Dependencies

If your project uses composer, you can persist the composer's internal cache directory. Dependencies cached are loaded directly instead of downloading them while installation. The files cached are available across check-runs and will reduce the workflow execution time.

- name: Get composer cache directory
  id: composer-cache
  run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
  uses: actions/cache@v2
  with:
    path: ${{ steps.composer-cache.outputs.dir }}
    key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
    restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
  run: composer install --prefer-dist

Notes

  • Please do not cache vendor directory using action/cache as that will have side effects.
  • If you do not commit composer.lock, you can use the hash of composer.json as the key for your cache.
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
  • If you support a range of composer dependencies and use prefer-lowest and prefer-stable options, you can store them in your matrix and add them to the keys.
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}-${{ matrix.prefer }}-
restore-keys: ${{ runner.os }}-composer-${{ matrix.prefer }}-

Composer GitHub OAuth

If you have a number of workflows which set up multiple tools or have many composer dependencies, you might hit the GitHub's rate limit for composer. Also, if you specify only the major version or the version in major.minor format, you can hit the rate limit. To avoid this you can specify an OAuth token by setting COMPOSER_TOKEN environment variable. You can use GITHUB_TOKEN secret for this purpose.

- name: Setup PHP
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
  env:
    COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Inline PHP Scripts

If you have to run multiple lines of PHP code in your workflow, you can do that easily without saving it to a file.

Put the code in the run property of a step and specify the shell as php {0}.

- name: Setup PHP
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'

- name: Run PHP code
  shell: php {0}
  run: |
    
    $welcome = "Hello, world";
    echo $welcome;

Problem Matchers

Problem matchers are json configurations which identify errors and warnings in your logs and surface them prominently in the GitHub Actions UI by highlighting them and creating code annotations.

PHP

Setup problem matchers for your PHP output by adding this step after the setup-php step.

- name: Setup problem matchers for PHP
  run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

PHPUnit

Setup problem matchers for your PHPUnit output by adding this step after the setup-php step.

- name: Setup problem matchers for PHPUnit
  run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

PHPStan

PHPStan supports error reporting in GitHub Actions, so it does not require problem matchers.

- name: Setup PHP
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
    tools: phpstan

- name: Run PHPStan
  run: phpstan analyse src

Psalm

Psalm supports error reporting in GitHub Actions with an output format github.

- name: Setup PHP
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
    tools: psalm

- name: Run Psalm
  run: psalm --output-format=github

Tools with checkstyle support

For tools that support checkstyle reporting like phpstan, psalm, php-cs-fixer and phpcs you can use cs2pr to annotate your code.
For examples refer to cs2pr documentation.

Here is an example with phpcs.

- name: Setup PHP
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.0'
    tools: cs2pr, phpcs

- name: Run phpcs
  run: phpcs -q --report=checkstyle src | cs2pr

Examples

Examples of using setup-php with various PHP Frameworks and Packages.

Framework/Package Runs on Workflow
Blackfire macOS, ubuntu and windows blackfire.yml
Blackfire Player macOS, ubuntu and windows blackfire-player.yml
CakePHP with MySQL and Redis ubuntu cakephp-mysql.yml
CakePHP with PostgreSQL and Redis ubuntu cakephp-postgres.yml
CakePHP without services macOS, ubuntu and windows cakephp.yml
CodeIgniter macOS, ubuntu and windows codeigniter.yml
Laravel with MySQL and Redis ubuntu laravel-mysql.yml
Laravel with PostgreSQL and Redis ubuntu laravel-postgres.yml
Laravel without services macOS, ubuntu and windows laravel.yml
Lumen with MySQL and Redis ubuntu lumen-mysql.yml
Lumen with PostgreSQL and Redis ubuntu lumen-postgres.yml
Lumen without services macOS, ubuntu and windows lumen.yml
Phalcon with MySQL ubuntu phalcon-mysql.yml
Phalcon with PostgreSQL ubuntu phalcon-postgres.yml
Roots/bedrock ubuntu bedrock.yml
Roots/sage ubuntu sage.yml
Slim Framework macOS, ubuntu and windows slim-framework.yml
Symfony with MySQL ubuntu symfony-mysql.yml
Symfony with PostgreSQL ubuntu symfony-postgres.yml
Symfony without services macOS, ubuntu and windows symfony.yml
Yii2 Starter Kit with MySQL ubuntu yii2-mysql.yml
Yii2 Starter Kit with PostgreSQL ubuntu yii2-postgres.yml
Zend Framework macOS, ubuntu and windows zend-framework.yml

🔖 Versioning

  • Use the v2 tag as setup-php version. It is a rolling tag and is synced with the latest minor and patch releases. With v2 you automatically get the bug fixes, security patches, new features and support for latest PHP releases. For debugging any issues verbose tag can be used temporarily. It outputs all the logs and is also synced with the latest releases.
  • Semantic release versions can also be used. It is recommended to use dependabot with semantic versioning to keep the actions in your workflows up to date.
  • Commit SHA can also be used, but are not recommended. They have to be updated with every release manually, without which you will not get any bug fixes, security patches or new features.
  • It is highly discouraged to use the master branch as version, it might break your workflow after major releases as they have breaking changes.
  • If you are using the v1 tag or a 1.x.y version, you should switch to v2 as v1 only gets critical bug fixes. Maintenance support for v1 will be dropped with the last PHP 8.0 release.

📜 License

  • The scripts and documentation in this project are under the MIT License.
  • This project has multiple dependencies. Their licenses can be found in their respective repositories.
  • The logo for setup-php is a derivative work of php.net logo and is licensed under the CC BY-SA 4.0 License.

👍 Contributions

Contributions are welcome!

  • See Contributor's Guide before you start.
  • If you face any issues or want to suggest a feature/improvement, start a discussion here.

Contributors of setup-php and other related projects

Contributors of setup-php and related projects

💖 Support This Project

  • Please star the project and share it. If you blog, please share your experience of using this action.
  • Please sponsor setup-php using GitHub sponsors.
  • Please reach out if you have any questions about sponsoring setup-php.

Sponsor shivammathur

Corporate Sponsors

Corporate sponsors of setup-php and related projects

Individual Sponsors

Individual sponsors of setup-php and related projects

📦 Dependencies

📑 Further Reading

Comments
  • Could not install memcached-3.1.5 on PHP 7.4.15

    Could not install memcached-3.1.5 on PHP 7.4.15

    Describe the bug memcached fails installing since today.

    Version 2.10.0

    Runners

    • [x] GitHub Hosted
    • [ ] Self Hosted

    Operating systems Linux

    PHP versions 7.4

    To Reproduce

                -   name: Setup PHP
                    uses: shivammathur/[email protected]
                    with:
                        php-version: 7.4
                        tools: cs2pr
                        extensions: mbstring,bcmath,intl,gd,zip,memcached-3.1.5,redis-5.3.3,rdkafka-5.0.0
                    env:
                        fail-fast: true
    

    Expected behavior This suddenly broke today.

    Screenshots/Logs

    
    ==> Setup PHP
    ✓ PHP Switched to PHP 7.4.15
    
    ==> Setup Tools
    ✓ composer Added composer 2.0.11
    ✓ cs2pr Added cs2pr 1.4.0
    
    ==> Setup Extensions
    ✓ mbstring Enabled
    ✓ bcmath Enabled
    ✓ intl Enabled
    ✓ gd Enabled
    ✓ zip Enabled
    ✗ memcached Could not install memcached-3.1.5 on PHP 7.4.15
    
    bug 
    opened by ruudk 25
  • Sudden pecl errors with self-hosted runner

    Sudden pecl errors with self-hosted runner

    Describe the bug

    My actions workflow on a self-hosted runner has started spitting out new pecl errors all of a sudden in PHP 8.0

    Version

    • [x] I have checked releases, and the bug exists in the latest patch version of v1 or v2.
    • [x] v2
    • [ ] v1

    Runners

    • [ ] GitHub Hosted
    • [x] Self Hosted

    Operating systems

    Ubuntu 20.04 LTS

    PHP versions

    PHP 8.0

    To Reproduce

    - name: Setup PHP
       uses: shivammathur/[email protected]
       with:
         php-version: 8.0
         tools: cs2pr
       env:
         runner: self-hosted # Specify the runner.
    

    Expected behavior

    It was working before as normal, setting up PHP 8.0.

    Screenshots/Logs

    Run shivammathur/[email protected]
      with:
        php-version: 8
        tools: cs2pr
        ini-file: production
      env:
        runner: self-hosted
    /bin/bash /opt/actions-runner/1/_work/_actions/shivammathur/setup-php/2.17.0/src/scripts/run.sh
    
    ==> Setup PHP
    grep: : No such file or directory
    grep: : No such file or directory
    /opt/actions-runner/1/_work/_actions/shivammathur/setup-php/2.17.0/src/scripts/../scripts/unix.sh: line 170: php_config: parameter null or not set
    ln: failed to create symbolic link '/opt/actions-runner/1/_work/_actions/shivammathur/setup-php/2.17.0/src/configs/ini/conf.d/99-pecl.ini': No such file or directory
    chmod: cannot access '/conf.d/99-pecl.ini': No such file or directory
    ✓ PHP Switched to PHP 
    
    ==> Setup Tools
    ✗ composer Could not download composer
    

    Additional context

    Are you willing to submit a PR?

    Honestly right now have no idea of a fix

    bug self-hosted 
    opened by Jamesking56 18
  • [NFR] Use Phalcon binary package/dll

    [NFR] Use Phalcon binary package/dll

    To speed up the action when using the Phalcon extension it would be great if there's an option to use the binary package on linux or precompiled dll's on Windows.

    Windows dll's can be found here. https://github.com/phalcon/cphalcon/releases/tag/v4.0.0

    Linux https://docs.phalcon.io/4.0/en/installation#linux

    enhancement 
    opened by ruudboon 18
  • Globally installed tools are not added to the `allow-plugins` option in `composer.json`

    Globally installed tools are not added to the `allow-plugins` option in `composer.json`

    Describe the bug Since version 2.2, any Composer plugin that needs to run must be listed in the allow-plugins config of the composer.json. I added the symfony/flex plugin to such list in the composer.json of my project, but it doesn't work because the tool is installed globally. To solve the problem, the composer global config --no-plugins allow-plugins.symfony/flex true command should be ran as part of the setup step.

    Version

    • [ ] I have checked releases, and the bug exists in the latest patch version of v1 or v2.
    • [x] v2
    • [ ] v1

    Runners

    • [x] GitHub Hosted
    • [ ] Self Hosted

    Operating systems ubuntu-latest

    PHP versions 8.1

    To Reproduce

    jobs:
      name: php
      on: [push]
      build:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v2
          - uses: shivammathur/setup-php@v2
             with:
               php-version: 8.1
               tools: flex
    

    Expected behavior The symfony/flex plugin is installed and allowed to run thanks to it being added to allow-plugins in composer.json. There should be no warning about the plugin being blocked.

    Screenshots/Logs

    symfony/flex (installed globally) contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe. See 
    https://getcomposer.org/allow-plugins
    You can run "composer global config --no-plugins allow-plugins.symfony/flex [true|false]" to enable it (true) or keep it disabled and suppress this warning (false)
    

    Additional context None

    Are you willing to submit a PR? I'm not familiar with how this action works under the hood, but I can try

    bug 
    opened by ste93cry 14
  • Incorrect openssl.cnf location for PHP 7.3 images

    Incorrect openssl.cnf location for PHP 7.3 images

    Describe the bug PHP with openssl comes with the following default paths to locate the (mandatory for some operations), openssl.cnf file:

    • PHP 7.4 and up:
      • C:\Program Files\Common Files\SSL\openssl.cnf (x64)
      • C:\Program Files (x86)\Common Files\SSL\openssl.cnf (x86)
    • prior to PHP 7.4.0, C:\usr\local\ssl\openssl.cnf.

    (source: PHP Manual: OpenSSL >Installing/Configuring)

    And those are the values, that the snapshots built here have. From this run, that is plenty of var_dump() information, I can see that:

    • The 7.3 job shows (phpinfo): Openssl default config => C:\usr\local\ssl/openssl.cnf
    • The 8.0 job shows (phpinfo): Openssl default config => C:\Program Files\Common Files\SSL/openssl.cnf

    So, all right so far.

    The problem is that the C:\usr\local\ssl/openssl.cnf file DOES NOT exist in the 7.3 environment, only the C:\Program Files\Common Files\SSL/openssl.cnf is there. The job above also tries to var_dump() the contents of the 2 files and only the later is there, both in the 7.3 and 8.0 snapshots.

    And that leads to all sort of failures with various openssl operations requiring a valid openssl.cnf, for example:

    PHP Warning:  openssl_pkey_export(): cannot get key from parameter 1 in ....
    

    In theory, that problem can be workaround by setting some env variable (OPENSSL_CONF, ...)pointing to the later file but, ideally, it should work without requiring that.

    So, somehow, that default Openssl default config should be pointing to the existing (later) file or, alternatively, that file should be copied to the former location so PHP 7.3 is able to find it.

    Version

    • [x] PHP 7.3 verified (and maybe also older versions).

    Operating systems

    • Github Actions Environments windows-latest (2019 right now).

    To Reproduce

    • Using the PHP and OS specified above, try any simple openssl script in PHP, for example:
    <?php
    
    $config = [
       "digest_alg" => "sha256",
       "private_key_bits" => 2048,
       "private_key_type" => OPENSSL_KEYTYPE_RSA,
    ];
    $res = openssl_pkey_new($config);
    openssl_pkey_export($res, $privatekey);
    var_dump($privatekey);
    

    Expected behavior A private key is generated and printed, without any PHP Warning

    Screenshots/Logs output / error log shows: PHP Warning: openssl_pkey_export(): cannot get key from parameter 1 in...

    Are you willing to submit a PR? Sorry, I'm not able to help with that... in fact I was not sure if this issue corresponds to this, to setup-php or to the environments themselves, noob here, specially with Windows stuff.

    If I can help with anything else, glad to help. Ciao :-)

    bug 
    opened by stronk7 12
  • Example code: remove `--no-interaction` from Composer commands

    Example code: remove `--no-interaction` from Composer commands


    name: ⚙ Improvement about: You found a bug, want to improve something or add a new feature labels: enhancement


    Description

    ~~All Composer commands used in CI should use --no-interaction to prevent them hanging in case interaction is expected.~~

    ~~This adds the --no-interaction argument to all Composer example code which did not have the argument yet.~~

    All Composer commands used in CI should use --no-interaction to prevent them hanging in case interaction is expected. However, as setupPHP sets the COMPOSER_NO_INTERACTION flag (as of this version), this is not needed when using setupPHP.

    This removes redundant --no-interaction arguments from the example code.

    Also see: https://blog.packagist.com/composer-2-2/#more-secure-plugin-execution

    opened by jrfnl 12
  • The process 'pwsh' failed with exit code 1

    The process 'pwsh' failed with exit code 1

    Describe the bug

    Installation on Windows fails since today with the following error message: The checksum of the downloaded CA certificates is wrong!

    To reproduce

    on: push
    
    jobs:
        main:
            runs-on: windows-latest
            steps:
                - name: Setup PHP
                  uses: shivammathur/setup-php@master
                  with:
                      php-version: 7.3
                      extension-csv: dom, filter, gd, hash, intl, json, pcre, pdo, zlib
                      coverage: none
    

    Log

    Run shivammathur/setup-php@master
    pwsh C:\hostedtoolcache\windows\win32.ps1 -version 7.3 -dir d:\a\_actions\shivammathur\setup-php\master\dist
    
    ==> Setup PhpManager 
    √ PhpManager Installed 
    
    ==> Setup PHP and Composer 
    The checksum of the downloaded CA certificates is wrong!
    At C:\Users\runneradmin\Documents\PowerShell\Modules\PhpManager\1.19.2.231\private\Get-CACertFromCurl.ps1:35 char:13
    +             throw "The checksum of the downloaded CA certificates is  ...
    +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (The checksum of the\u2026tificates is wrong!:String) [], RuntimeException
    + FullyQualifiedErrorId : The checksum of the downloaded CA certificates is wrong!
    
    ##[error]The process 'pwsh' failed with exit code 1
    ##[error]Node run failed with exit code 1
    

    Additional information

    https://github.com/leofeyer/gha-test/commit/b9c59a05a74bf5bc1632b69eb87891094054d187/checks?check_suite_id=331319247

    bug 
    opened by leofeyer 12
  • Could not install imagick on PHP 7.4.21

    Could not install imagick on PHP 7.4.21

    Describe the bug

    Version

    • [ ] I have checked releases, and the bug exists in the latest patch version of v1 or v2.
    • [x] v2
    • [ ] v1

    Runners

    • [x] GitHub Hosted
    • [ ] Self Hosted

    Operating systems MacOS

    PHP versions 7.4

    To Reproduce

      build-and-test-macos:
        # To prevent build a particular commit use
        #     git commit -m "......... [ci skip]"
        if: "!contains(github.event.head_commit.message, 'ci skip')"
    
        needs: generate
        runs-on: ${{ matrix.operating-system }}
        env:
          extensions: mbstring, intl, json, yaml, apcu, imagick, gd, gettext, igbinary, redis
          HOMEBREW_NO_INSTALL_CLEANUP: 1
          ext_cache_key: v5.0.0-alpha.2-macOS
        strategy:
          fail-fast: false
          matrix:
            operating-system: [macos-latest]
            php-versions: ['7.4', '8.0']
    
        name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
        steps:
    
          - name: Checkout Code
            uses: actions/checkout@v2
            with:
              fetch-depth: 1
    
          - name: Setup cache environment
            id: extcache
            uses: shivammathur/cache-extensions@v1
            with:
              php-version: ${{ matrix.php-versions }}
              extensions: ${{ env.extensions }}
              key: ${{ env.ext_cache_key }}
    
          - name: Cache extensions
            uses: actions/cache@v2
            with:
              path: ${{ steps.extcache.outputs.dir }}
              key: ${{ steps.extcache.outputs.key }}
              restore-keys: ${{ steps.extcache.outputs.key }}
    
    #      - name: Install Requirements for Imagick
    #        run: |
    #          export HOMEBREW_MAKE_JOBS="-j$(getconf _NPROCESSORS_ONLN)"
    #          brew install pkg-config imagemagick@7
    
          - name: Setup PHP
            uses: shivammathur/setup-php@v2
            with:
              php-version: ${{ matrix.php-versions }}
              ini-values: apc.enable_cli=on, session.save_path=/tmp
              extensions: ${{ env.extensions }}
    

    Expected behavior Installed imagick on PHP 7.4

    Screenshots/Logs https://github.com/phalcon/cphalcon/pull/15561/checks?check_run_id=2950380446#step:5:25

    Additional context

    Are you willing to submit a PR?

    bug 
    opened by Jeckerson 11
  • Support tools: none

    Support tools: none

    Describe the feature

    Please consider supporting tools: none when not even Composer is installed.

    Currently there is a message with "unknown tool". https://github.com/shivammathur/setup-php/blob/master/src/tools.ts#L536

    Thank you.

    enhancement 
    opened by szepeviktor 11
  • PHP Startup: Unable to load dynamic library 'gd.so'

    PHP Startup: Unable to load dynamic library 'gd.so'

    Describe the bug PHP GD and other plugins are not available

    Version

    • [x] I have checked releases, and the bug exists in the latest patch version of v1 or v2.
    • [x] v2
    • [x] v1

    Runners

    • [ ] GitHub Hosted
    • [x] Self Hosted

    Operating systems

    PHP versions 7.3, 7.4, 8.0

    To Reproduce actions.yml

    on: [push]
    
    jobs:
      main:
        runs-on: ubuntu-latest
        steps:
        - uses: actions/checkout@v2
        - uses: shivammathur/setup-php@master
          with:
            coverage: pcov
            php-version: '7.4'
            extension: dom, fileinfo, mbstring, gd
        - run: |
            composer install 
    
    
    

    Expected behavior To work

    Screenshots/Logs

    | PHP Warning:  PHP Startup: Unable to load dynamic library 'gd.so' (tried: /usr/lib/php/20190902/gd.so (libX11.so.6: cannot open shared object file: No such file or directory), /usr/lib/php/20190902/gd.so.so (/usr/lib/php/20190902/gd.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
    | PHP Warning:  PHP Startup: Unable to load dynamic library 'snmp.so' (tried: /usr/lib/php/20190902/snmp.so (libnetsnmp.so.35: cannot open shared object file: No such file or directory), /usr/lib/php/20190902/snmp.so.so (/usr/lib/php/20190902/snmp.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
    
    
    workflow-edit 
    opened by peter-mw 11
  • PHP 8 on Windows - inet_pton not found

    PHP 8 on Windows - inet_pton not found

    Describe the bug When running PHP 8.0 version on Windows, the inet_pton function is not found.

    • https://www.php.net/manual/en/function.inet-pton.php
    • https://github.com/phpstan/phpstan/blob/894c59fcf79df09aba631ac52230efbcd15048e0/.github/workflows/build.yml#L15-L50

    Version

    • [x] I have checked releases and the bug exists in the latest patch version of v1 or v2.
    • [x] v2
    • [ ] v1

    Runners

    • [x] GitHub Hosted
    • [ ] Self Hosted

    Operating systems

    Windows

    PHP versions

    8.0

    To Reproduce

    Run composer update with composer:snapshot on PHP 8.0 windows-latest

    Expected behavior

    Screenshots/Logs

    https://github.com/phpstan/phpstan-src/runs/992276871?check_suite_focus=true

    bug upstream-issue 
    opened by ondrejmirtes 11
  • Support for Relay

    Support for Relay

    Describe the feature

    I'm one of the makers of Relay and we're heavy users shivammathur/setup-php ourselves and would love to see Relay support.

    Underlying issue

    Installing Relay is a little verbose on GitHub Actions, since it requires the msgpack and igbinary extensions and some extra steps.

    Describe alternatives

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          extensions: msgpack, igbinary
    
      - name: Install Relay
        run: |
          curl -L "https://builds.r2.relay.so/${{ env.relay }}/relay-${{ env.relay }}-php${{ env.php }}-debian-x86-64.tar.gz" | tar xz
          cd relay-${{ env.relay }}-php${{ env.php }}-debian-x86-64
          sudo cp relay.ini $(php-config --ini-dir)
          sudo cp relay-pkg.so $(php-config --extension-dir)/relay.so
          sudo sed -i "s/00000000-0000-0000-0000-000000000000/$(cat /proc/sys/kernel/random/uuid)/" $(php-config --extension-dir)/relay.so
    

    Additional context

    https://relay.so/docs/1.x/installation#github-actions

    Are you willing to submit a PR?

    Yes, but we don't know where to start. Happy to become sponsors as well 👍

    enhancement 
    opened by tillkruss 2
  • Could not install zephir_parser on PHP x.x.xx

    Could not install zephir_parser on PHP x.x.xx

    Describe the bug It is impossible to install pecl package inside Windows env.

    Version

    • [ ] I have checked releases, and the bug exists in the latest patch version of v1 or v2.
    • [x] v2
    • [ ] v1

    Runners

    • [x] GitHub Hosted
    • [ ] Self Hosted

    Operating systems Windows2019

    PHP versions Any

    To Reproduce https://github.com/zephir-lang/zephir/actions/runs/3790395319/jobs/6449129559#step:3:35

    enhancement 
    opened by Jeckerson 2
  • `sed: illegal option -- r` in MacOS

    `sed: illegal option -- r` in MacOS

    Describe the bug MacOS runs failing.

    Version

    • [ ] I have checked releases, and the bug exists in the latest patch version of v1 or v2.
    • [x] v2
    • [ ] v1

    Runners

    • [x] GitHub Hosted
    • [ ] Self Hosted

    Operating systems MacOS

    PHP versions Any

    To Reproduce https://github.com/zephir-lang/zephir/actions/runs/3783117341/jobs/6431403311#step:3:28

    bug awaiting-release 
    opened by Jeckerson 4
  • pick up PHP version from composer.json

    pick up PHP version from composer.json

    Describe the feature

    for example actions/setup-go@v3, pick up Golang version from go.mod

    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-go@v3
        with:
          go-version-file: "go.mod"
      - run: go version
    

    I want to pick up PHP version from composer.json, like this

    steps:
      - uses: actions/checkout@v3
      - uses: shivammathur/setup-php@v2
        with:
          php-version-file: 'composer.json'
      - run: php --version
    

    composer.json like this

    {
      "name": "foo/bar",
      "version": "0.0.1",
      "license": "MIT",
      "require": {
        "php": "^8.0|^8.1"
      }
    }
    

    Version

    • [x] I have checked releases, and the feature is missing in the latest patch version of v2.

    Underlying issue

    When PHP version up, I must do same change to composer.json and GHA workflow yaml files.

    Describe alternatives

    Additional context

    Are you willing to submit a PR?

    I can try!

    enhancement 
    opened by watarukura 3
Releases(2.23.0)
  • 2.23.0(Dec 25, 2022)

    Support Ukraine

    #StandWithUkraine


    • Added support for nightly builds of PHP 8.3. Note: Specifying nightly as the php-version now will set up PHP 8.3.
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.3'
    
    • PHP 8.2 is now stable on setup-php. #673 Notes:
      • Specifying latest or 8.x as the php-version now will set up PHP 8.2.
      • Except ubuntu-22.04, all GitHub runners now have PHP 8.2 as the default version.
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.2'
    
    • Added support for thread-safe builds of PHP on Linux. #651
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.2'
      env:
        phpts: ts
    
    • Improved extension support on macOS for various extensions using the shivammathur/extensions tap.

      • ds https://github.com/shivammathur/homebrew-extensions/issues/2250
      • gearman https://github.com/shivammathur/homebrew-extensions/issues/2161
      • lua https://github.com/shivammathur/homebrew-extensions/issues/1898
      • sqlsrv and pdo_sqlsrv https://github.com/shivammathur/homebrew-extensions/issues/2032
      • v8js https://github.com/shivammathur/homebrew-extensions/issues/1899
    • Dropped support for macos-10.15 GitHub runner. Please update your workflows to use macos-latest or macos-12 runner.

    • Fixed support for composer-unused. #668

    • Fixed support for ini-values with the = sign in the value. #676

    • Added fallbacks to various tools and extensions that use the GitHub API for setup to avoid rate limit errors on Windows.

    • Fixed a minor error on macOS while patching updated dependency formulae.

    • Updated Node.js dependencies.


    Full Changelog: https://github.com/shivammathur/setup-php/compare/2.22.0...2.23.0

    Merry Christmas and happy holidays! 🎄🎁

    Thanks! @jrfnl and @flavioheleno for the contributions 🎉

    Follow for updates

    setup-php reddit setup-php twitter setup-php status

    Source code(tar.gz)
    Source code(zip)
  • 2.22.0(Oct 28, 2022)

    Support Ukraine

    #StandWithUkraine


    • Added support for PHP builds with debugging symbols for PHP 5.6 and above. ALPHA Docs, (#634, shivammathur/homebrew-php#976)
    - name: Setup PHP with debugging symbols
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.1'
      env:
        debug: true 
    
    • Added support for intl extension with ICU 72.1. shivammathur/icu-intl#4
    - name: Setup PHP with intl
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.1'
        extensions: intl-72.1
    
    • Existing PHP version on GitHub actions Ubuntu images is now updated if ppa:ondrej/php is missing regardless of the update environment variable. (actions/runner-images#6331).

    • Environment variable COMPOSER_NO_AUDIT is now set by default. If you would like to run the composer audit in your workflows, please add a step with composer audit command. (#635, #636)

    - name: Composer audit
      run: composer audit
    
    • Switched to GITHUB_OUTPUT environment file for setting up outputs. If you are using setup-php on self-hosted runners, please update it to 2.297.0 or greater. More Info (#654)

    • Updated sqlsrv and pdo_sqlsrv version to 5.10.1 for PHP 7.0 and above on Linux.

    • Improved support for phalcon5 extension to set up the latest stable version.

    • Improved symfony-cli support to fetch the artifact URL from the brew tap on Linux. (#641, #652, #653)

    • Improved fetching brew taps on Linux to avoid brew's overhead.

    • Fixed installing extension packages on self-hosted Linux runners. (#642)

    • Fixed support for couchbase and firebird extensions after GitHub release page changes.

    • Fixed support for older versions of laravel/pint. (#647)

    • Updated Node.js dependencies.


    Full Changelog: https://github.com/shivammathur/setup-php/compare/2.21.2...2.22.0

    Thanks! @alcaeus and @jderusse for the contributions 🎉

    Follow for updates

    setup-php reddit setup-php twitter setup-php status

    Source code(tar.gz)
    Source code(zip)
  • 2.21.2(Aug 17, 2022)

    Support Ukraine

    #StandWithUkraine


    • Added support for rector in tools input. #627
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: 8.1
        tools: rector
    
    • Added support for ast extension on macOS using shivammathur/extensions tap.
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: 8.1
        extensions: ast
    
    • Fixed support for symfony-cli on Linux #632
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: 8.1
        tools: symfony
    
    • Fixed installing unstable extensions from PECL. #625
    • Updated Node.js dependencies.

    Follow for updates

    setup-php reddit setup-php twitter setup-php status

    Source code(tar.gz)
    Source code(zip)
  • 2.21.1(Jul 28, 2022)

  • 2.21.0(Jul 19, 2022)

    Support Ukraine

    #StandWithUkraine


    • Added support for Laravel Pint #613, #614
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: `8.1`
        tools: pint
    
    • Added support for phalcon5 for all OS. https://github.com/shivammathur/homebrew-extensions/issues/1890 Also fixed phalcon3 and phalcon4 support on Ubuntu 22.04.
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: `8.1`
        extensions: phalcon5
    
    • Added support for Private Packagist authentication for composer. Docs
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.1'
      env:
        PACKAGIST_TOKEN: ${{ secrets.PACKAGIST_TOKEN }}
    
    • Added support for manual JSON-based authentication for composer Docs
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.1'
      env:
        COMPOSER_AUTH_JSON: |
          {
            "http-basic": {
              "example.org": {
                "username": "${{ secrets.EXAMPLE_ORG_USERNAME }}",
                "password": "${{ secrets.EXAMPLE_ORG_PASSWORD }}"
              }
            }
          }
    
    • Deprecated COMPOSER_TOKEN in favor of GITHUB_TOKEN. Docs
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.1'
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    
    • Updated Node.js dependencies.

    Thanks! @phpstan for the sponsorship ❤️

    Thanks! @d8vjork and @ChristophWurst for the contributions 🎉

    Follow for updates

    setup-php reddit setup-php twitter setup-php status

    Source code(tar.gz)
    Source code(zip)
  • 2.20.1(Jul 7, 2022)

  • 2.20.0(Jul 5, 2022)

    Support Ukraine

    #StandWithUkraine


    • Improved support for event extension on Linux and macOS for PHP 5.4 and above. #604

    • Fixed support for composer plugins in tools input. Since composer 2.2, the plugins are required to be marked as allowed in the composer config. This will now be done by default. #611

    • Added support to show code coverage driver's (Xdebug/PCOV) version in the logs when setup using the coverage input. #610

    • Fixed a bug where PHP was not added to PATH during the action run on self-hosted Windows environments. #609

    • Fixed a bug where the tool cache path was not set on self-hosted environments. #606

    • Updated Node.js dependencies.


    Thanks! @jrfnl, @dino182 and @markseuffert for the contributions 🚀

    Follow for updates

    setup-php reddit setup-php twitter setup-php status

    Source code(tar.gz)
    Source code(zip)
  • 2.19.1(Jun 6, 2022)

  • 2.19.0(May 30, 2022)

    Support Ukraine

    #StandWithUkraine


    • Added support for ubuntu-22.04 runner. Docs

    • Added support for Couchbase extension 4.x for PHP 7.4 and above. Also added support to specify the extension version you need. https://github.com/shivammathur/setup-php/issues/593

      Note: Please use the extensions cache if using the latest Couchbase version on Linux as it can take 10+ minutes to build along with its library.

      To install the latest version of couchbase extension

      - name: Setup PHP
        uses: shivammathur@setup-php@v2
        with:
          php-version: '8.1'
          extensions: couchbase
      

      To install a specific version - suffix couchbase with exact version you want in the extensions input.

      - name: Setup PHP
        uses: shivammathur@setup-php@v2
        with:
          php-version: '7.4'
          extensions: couchbase-2.6.2
      
    • Improved fallback support upon cache failure in composer setup. This fixes an error when the latest composer version was installed on older PHP versions when fetching composer from shivammathur/composer-cache failed.

    • Bumped Node.js version required to 16.x. Also bumped build target version to ES2021.

    • Removed support for Debian 9 and Ubuntu 21.04 for self-hosted runners. Docs

    • Fixed tools setup with older composer versions which do not create composer.json if missing in the directory.

    • Fixed support for extensions on macOS where the extension package name might conflict with package names in homebrew-core repo. This fixes support for redis extension on macOS on PHP 7.0.

    • Fixed enabling cached extensions which depend on other extensions on PHP 7.1 and lower.

    • Fixed setting default INI values so that it is possible to override those using php -c. https://github.com/shivammathur/setup-php/issues/595

    • Fixed PECL support for PHP 5.3, this was broken in previous release while adding support for specifying configure options, as that is only supported on PHP 5.4 and above.

    • Fixed identifying the latest protoc release.

    • Removed unnecessary fs dependency.

    • Added dependabot config to update older actions in workflows. https://github.com/shivammathur/setup-php/pull/597

    • Added permissions for GITHUB_TOKEN in workflows. https://github.com/shivammathur/setup-php/pull/596

    • Updated Node.js dependencies.


    Thanks! @naveensrinivasan for the contributions 🚀

    Follow for updates

    setup-php reddit setup-php twitter setup-php status

    Source code(tar.gz)
    Source code(zip)
  • 2.18.1(Apr 9, 2022)

    Support Ukraine

    #StandWithUkraine


    • Added support for ICU 71.1 based intl extension setup. https://github.com/shivammathur/icu-intl/pull/3
    - name: Setup PHP with intl
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.1'
        extensions: intl-71.1
    
    • Added support for macOS Monterey (macos-12) GitHub hosted environment.

    • Added support for mcrypt extension using shivammathur/extensions tap on macOS.

    • Fixed patching brew for overwriting existing linked libraries.

    • Fixed identifying the latest protoc release.

    • Updated Node.js dependencies.


    Thanks! @jderusse for the contributions 🚀

    Follow for updates

    setup-php reddit setup-php twitter setup-php status

    Source code(tar.gz)
    Source code(zip)
  • 2.18.0(Mar 22, 2022)

    Support Ukraine

    #StandWithUkraine


    • Added support for installing libraries and custom configure options for PECL extensions. #575. Docs.

    • Added support for blackfire extension on PHP 8.1 on Windows.

    • Improved support for http extension on Windows and self-hosted environments.

    • Fixed installing php-dev package on self-hosted environments when missing. #569

    • Fixed linking pecl ini file on self-hosted environments. #569

    • Fixed copying extensions when installed using brew from its Cellar to extension directory on macOS.

    • Fixed generating extension dependency map.

    • Fixed a bug in log functions on Linux and macOS by using local variables.

    • Improved switching versions on Linux. #572

    • Improved enabling default extensions by reducing PHP calls.

    • Bumped actions/checkout, actions/upload-artifact, actions/download-artifact and actions/cache version in examples and workflows to v3. #571, #577

    • Added PECL customization guide to README.

    • Updated Node.js dependencies.


    Thanks! @jrfnl for the contributions 🚀

    Follow for updates

    setup-php reddit setup-php twitter setup-php status

    Source code(tar.gz)
    Source code(zip)
  • 1.11.7(Apr 9, 2022)

    v1 maintenance release

    • Added support for mcrypt extension using shivammathur/extensions tap on macOS.
    • Fixed Composer setup for changes since Composer 2.3.
    • Fixed patching brew for overwriting existing linked libraries
    • Refactored updating dependencies on macOS.
    • Updated Node.js dependencies.
    • Updated docs for supported GitHub Hosted environments.
    Source code(tar.gz)
    Source code(zip)
  • 2.17.1(Mar 1, 2022)

    This release is possible because of our sponsors ❤️.

    Help setup-php reach its sponsorship goals.

    Sponsor shivammathur


    • Added support for OpenSSL config on Windows. #564 Now setup-php will set the environment variable OPENSSL_CONF pointing to a valid openssl.cnf file on Windows.

    • Added GitHub releases fallback URL for phing.

    • Updated version of sqlsrv and pdo_sqlsrv extensions to 5.10.0 for PHP 7.4 and above.

    • Fixed logs for symfony-cli on failure. #568

    • Fixed setting an environment variable on Windows in self-hosted environments.

    • Fixed a bug in adding a directory to PATH. #562

    • Fixed a minor UUOC shellcheck warning in add_tools.sh.

    • Updated Node.js dependencies.


    Thanks! @mlocati for adding Set-OpenSSLConf 🚀

    Follow for updates

    setup-php reddit setup-php twitter setup-php status

    Source code(tar.gz)
    Source code(zip)
  • 2.17.0(Feb 8, 2022)

    This release is possible because of our sponsors ❤️.

    Help setup-php reach its sponsorship goals.

    Sponsor shivammathur


    • Added ini-file input to specify the base php.ini file. Accepts production, development or none. Docs (#450, #469)

    By default the production php.ini is used, you can change it to the development one, or remove it using none.

    - name: Setup PHP
      with:
        php-version: '8.1'
        ini-file: development
    
    - name: Setup PHP
      with:
        php-version: '8.1'
        tools: symfony-cli
    
    - name: Setup PHP
      with:
        php-version: '8.1'
        tools: churn
    
    • Added support for blackfire extension on PHP 8.1.
    - name: Setup PHP
      with:
        php-version: '8.1'
        extensions: blackfire
    
    • Tools pecl, phpize and php-config are now installed by default on Linux. Specifying these in tools input is no longer required.

    • The environment variable COMPOSER_NO_INTERACTION is now set to 1 by default, so using --no-interaction in composer commands is not required. (#547)

    • The environment is now considered self-hosted unless the GitHub hosted environment is detected. This should prevent broken PHP installs in self-hosted environments when the runner environment variable is not specified. (#554)

    • Added support to enable disabled extensions when required by tools. For this extensions are now processed before tools.

    • Added support to enable xml extension before installing other extensions using pecl. (#553)

    • Speed improvements

      • Reduced the initial I/O in script creation.
      • Reduced the number of PHP calls and it now uses php-config instead.
      • Reduced number of brew calls on macOS setup.
      • Windows builds for all PHP versions are now fetched from shivammathur/php-builder-windows releases as a faster cache with windows.php.net as a fallback.
      • SSL libraries for PHP 5.3 to 5.5 on Windows are now fetched in parallel.
      • PHP builds for PHP 5.3 to 5.5 should now use cached macports builds from shivammathur/php5-darwin.
    • Added support for installing tools using composer in different scopes. This allows installing two tools with different versions of a common dependency. (#549)

    • Added support to fail immediately when composer setup fails. (#548)

    • Added support to parse PECL extension versions when wrongly hyphenated. (#536)

    • Added support for composer phars from shivammathur/composer-cache with PHP version as now different PHP versions can have different composer versions for a release type.

    • Added setup-php.com as a fallback in addition to jsdeliver.com for script sources.

    • Fixed support for fallback sources for tools in Windows.

    • Fixed potential exponential backtracking in regex to parse extension input when installing extensions from a git repository.

    • Fixed adding sudo to self-hosted Linux environments. (#555)

    • Fixed enabling disabled extensions with other extensions as dependencies. For example pecl_http, redis, etc.

    • Fixed a bug where the ini file used for enabling extensions by pecl in the scan directory was deleted when disabling extensions.

    • Fixed misconfiguration which prevented package lists from updating on Linux.

    • Fixed the fallback to install PowerShell packages using Install-Module on Windows when GitHub Releases is down. Also fixed not adding the Import-Module command to the profile when it fallbacks.

    • Fixed tools setup to not overwrite an existing tool with a broken one if it fails to set up.

    • Fixed an error when copying tools to a directory in PATH in tools setup.

    • Fixed parsing composer phars from snapshot channel for its version when is a stable version.

    • Fixed support for oci8 and pdo_oci extensions on Windows.

    • Fixed pecl_http setup.

    • Fixed restore-keys input in composer cache example in README with dependency range.

    • Fixed error in tools setup on self-hosted environments when composer's bin directory is not present.

    • Fixed tools.getLatestVersion to handle failing GitHub API call.

    • Fixed output on non-GitHub Action environments where GitHub Action specific command syntax was printed.

    • Fixed a bug where the status variable was overwritten in ppa.sh and was breaking the status output.

    • Fixed scope of variables to local in bash scripts.

    • Fixed setting extension stability in Add-Extension Function on Windows.

    • Fixed node-release workflow to add lib directory to the packages.

    • Fixed sending coverage data to codecov on pull requests.

    • Refactored utils.fetch to its own module and mocked the http module using nock for fetch tests. Now the Node.js test suite does not make any external requests.

    • Refactored setting environment variables and adding to PATH.

    • Refactored setting outputs to functions with a check to only run on GitHub Actions.

    • Refactored extension functions to add_extension.sh and add_extension.ps1.

    • Refactored the default PHP packages for self-hosted Linux environments to a config file. Also added cgi, fpm, mysql, opcache, pgsql and zip to the list.

    • Refactored Nightly PHP setup to Install-PhpNightly Function on Windows.

    • Refactored CI workflows and templates.

    • Rename common.sh to unix.sh.

    • Update security policy to specify clearly that the latest patch versions of both v1 and v2 are supported for security updates.

    • Updated Node workflows to use 16.x.

    • Updated README for the release.

    • Updated Node.js dependencies.


    Thanks! @jrfnl and @villfa for the contributions 🚀

    Follow for updates

    setup-php reddit setup-php twitter setup-php status

    Source code(tar.gz)
    Source code(zip)
  • 1.11.6(Feb 8, 2022)

    v1 maintenance release

    • Fix Node.js tests.
    • Fix manifest URL for v1.
    • Add CodeQL workflow.
    • Update Node workflow to use Node 16.
    • Update Node.js dependencies.
    • Fix sending coverage data to codecov.
    • Update docs.
    Source code(tar.gz)
    Source code(zip)
  • 2.16.0(Nov 25, 2021)

    This release is possible because of our sponsors. So, if your company uses setup-php, please ask them to sponsor my work.

    Sponsor shivammathur


    • PHP 8.1 is now stable (8.1.0) and marked as the latest version. 🥳
    - name: Setup PHP 8.1
      uses: shivammathur/setup-php@v2
      with:
        php-version: latest
    
    • PHP 7.3 to PHP 8.1 packages have been updated to 7.3.33, 7.4.26, 8.0.13, and 8.1.0 respectively. Set the update environment variable to true for always updating to the latest patch version.
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      env:
        update: true
      with:
        php-version: '8.0'
    
    • PHP 5.6 to 7.2 have been rebuilt with patch for CVE-2021-21707 backported from PHP 7.3.33.

    • Add support for ICU-70.1 based intl extension for PHP 5.6 and above. https://github.com/shivammathur/icu-intl/pull/2

    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: 7.4
        extensions: intl-70.1
    
    • Add support for mailparse and xlswriter extensions on macOS using shivammathur/extensions tap.
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: 7.4
        extensions: mailparse, xlswriter
    
    • Fix upgrading nightly versions on self-hosted runners. Now PHP 8.2 will update to the latest build when the update environment variable is set to true.
    • Fix support for brew extensions with different package and extension name.
    • Fix support for Imagick extension on Windows. https://github.com/shivammathur/setup-php/pull/528
    • Fix error while Blackfire configuration file is opened in tool's set up on Linux.
    • Fix extension support to install extension packages from ppa:ondrej/php in php-builder builds.
    • Fix dependency support in self-hosted macOS.
    • Fix to only copy problem-matchers configs to RUNNER_TOOL_CACHE.
    • Fix support for Phalcon extension.
    • Fix CA certificate issues on windows. #511, #517
    • Fix to suppress error when extensions are cached on Windows.
    • Log error when wrong Xdebug version is requested as coverage driver for a PHP version. https://github.com/shivammathur/setup-php/issues/519
    • Add patch to support self-hosted environments on Debian 12 or distributions based on it.
    • Add action to limit outbound requests to known endpoints in node workflow.
    • Add links for all tools in the README. https://github.com/shivammathur/setup-php/pull/518
    • Add workflow to publish to NPM and GitHub packages. #513
    • Use jest.each for extensions and install modules' tests. #514, #516,
    • Update Node.js dependencies.

    Thanks! @jrfnl, @jderusse, and @aneeshrelan for the contributions 🚀

    Follow for updates

    setup-php reddit setup-php twitter setup-php status

    Source code(tar.gz)
    Source code(zip)
  • 2.15.0(Sep 28, 2021)

    Setup PHP depends on sponsorships. Maintaining it takes time and money especially with daily builds for upcoming PHP versions. So, if you found it helpful, please support the project.

    Sponsor shivammathur


    • PHP 5.6 to 7.2 have been rebuilt with patch for CVE-2021-21706 backported from 7.3.31.

    • PHP 7.3 to PHP 8.0 packages have been updated to 7.3.31, 7.4.24 and 8.0.11 respectively. Set the update environment variable to true for always updating to the latest patch version.

    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      env:
        update: true
      with:
        php-version: '8.0'
    
    • Add support for the following tools:

      • phpunit-polyfills #503
      • phpDocumentor or phpdoc #498
      • parallel-lint #500
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.0'
        tools: phpDocumentor, parallel-lint, phpunit-polyfills
    
    • Add support for expect and ssh2 extensions on macOS. https://github.com/shivammathur/homebrew-extensions/issues/1097
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.0'
        extensions: expect, ssh2
    
    • Fix parsing PHP 8.1 version with both RC and dev suffixes in the semver notation.

    • Fix to get correct php-src git ref for nightly builds.

    • Fix version for extensions in logs when installed using PECL.

    • Fix cache support for extensions with custom support. #496

    • Fix logs for extensions with custom support when cached.

    • Fix PPA setup to add/update list files in /var/lib/apt/lists. #492

    • Fix typo to use correct key for phpunit in tools.functionRecord. #501

    • Replace husky with simple-git-hooks.

    • Cleanup trailing whitespace in README.

    • Fix git command in format NPM script.

    • Update Node.js dependencies.


    Thanks @jrfnl for the contributions 🚀

    Follow for updates

    setup-php reddit setup-php twitter setup-php status

    Source code(tar.gz)
    Source code(zip)
  • 1.11.5(Sep 28, 2021)

    • Add support for expect and ssh2 extensions using shivammathur/extensions on macOS.
    • Fix version for extensions in logs when installed using PECL.
    • Replace husky with simple-git-hooks.
    • Update Node.js dependencies.
    Source code(tar.gz)
    Source code(zip)
  • 2.14.0(Sep 11, 2021)

    • Add support for PHP 8.2. #490, Docs
    • Specifying 8.2 in the php-version input will set up a nightly build of PHP 8.2.0-dev from the master branch of php/php-src.
    - name: Setup PHP 8.2
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.2'
    
    • Add support for the nightly alias for setting up a build from the master branch. #491, Docs
    • This will also set up PHP 8.2.0-dev from the master branch of php/php-src.
    - name: Setup PHP 8.2
      uses: shivammathur/setup-php@v2
      with:
        php-version: nightly
    
    • Add support to disable all shared extensions. #487 Docs
    • Specifying none in extensions input will now disable all shared extensions.
    • If none is specified along with other extensions then setup-php will first remove all shared extensions, and then process the other extensions in the input.
    • As part of this feature from now on, shared extensions will just be disabled, and not removed completely.

    ❤️ Thanks! @sebastianbergmann and @localheinz for sponsoring this feature.

    - name: Setup PHP without any shared extensions except mbstring
      uses: shivammathur/setup-php@v2
      with:
        php-version: 8.0
        extensions: none, mbstring
    
    • Fix disabling extensions to identify dependent extensions using the Reflection data and disable them as well. For example, disabling PDO will also disable pdo_mysql.

    • Fix warnings in Windows when the required directory is already present.

    • Fix to identify opcache if Zend OPcache is specified in extensions input.

    • Fix Windows script to install PHP 8.2 and future nightly builds correctly.

    • Fix to parse PHP 8.1 semver version.

    • Use shivammathur/extensions tap to install vips extension on macOS.


    Internal

    • Add test cases for ini-values containing special characters to config.test.ts to avoid regression.

    • Add bugs, directories, files and types properties in package.json.

    • Add an SVG with past and present individual sponsors to the README.

    • Use commit hash from the path in URL instead of the query string for nightly builds on macOS.

    • Fix build error in install.ts after TypeScript upgrade.

    • Minor refactor in install.test.ts.

    • Refactor config and coverage test files to use jest.each.

    • Update tsconfig to generate type declarations.

    • Update documentation in the README.

    • Update versions in SECURITY.md.

    • Update Node.js dependencies.

    Source code(tar.gz)
    Source code(zip)
  • 1.11.4(Sep 11, 2021)

    v1 maintenance release

    • Add Windows-2022 to the README.
    • Use PhpManager on Windows for all PHP versions supported on v1.
    • Fix unsupported PHP versions warning on v1.
    • Fix warnings in Windows when the required directory is already present.
    • Use shivammathur/extensions tap to install vips extension on macOS.
    • Add an SVG with past and present individual sponsors to the README.
    • Update tsconfig to generate type declarations.
    • Add bugs, directories, files and types properties in package.json.
    • Update SECURITY.md.
    • Update Node.js dependencies.
    Source code(tar.gz)
    Source code(zip)
  • 2.13.0(Aug 23, 2021)

    • Added support for Debian on self-hosted environments and containers.
    • Debian 9 and above are supported in addition to existing Ubuntu support.
    • Operating systems based on these versions of Debian are also supported on a best-effort basis.
    container: debian:bullseye
    steps:
      - name: Install PHP on Debian
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.0'
        env:
          runner: self-hosted
    
    • Added windows-2022 to the supported OS environments.
    runs-on: windows-2022
    steps:
      - name: Install PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.0'
    
    • Added support for phpunit-bridge and updated symfony examples to install it using setup-php.
    - name: Setup PHP with Phive
      with:
        php-version: '8.0'
        tools: phpunit-bridge
    
    • Added documentation to run multi-line PHP code in workflows. #482
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.0'
    
    - name: Run PHP code
      shell: php {0}
      run: |
        <?php
        $welcome = "Hello, world";
        echo $welcome;
    
    • Added support for extensions mongodb and yaml on macOS using shivammathur/extensions tap.
    • Added a specific phive version compatible with PHP 7.2. #481
    - name: Setup PHP with Phive
      uses: shivammathur/setup-php@v2
      with:
        php-version: '7.2'
        tools: phive
    
    • Added --no-install-recommends to apt install commands on Linux.
    • Added support for JavaScript actions on shivammathur/node images. spc is no longer required for multi-arch workflows and normal GitHub Action syntax should work.
    container: shivammathur/node:latest-${{ matrix.arch }}
    strategy:
      matrix:
        arch: ["amd64", "i386"]
    steps:
      - name: Install PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.0'
    
    • PHP 8.1 on Linux in shivammathur/php-builder is now built nightly with the same configuration and patches as official Debian builds of PHP.
    - name: Setup PHP 8.1
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.1'
    
    • Added a new flag NO_TOOLS_CACHE. The tool will be fetched from the source instead of any cache that setup-php implements when this is set to true.
    • This can be useful for maintainers to make sure a new version of their tool is used instead of the old cached version.
    • As of this release, only composer phars are cached.
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      env:
        NO_TOOLS_CACHE: true
      with:
        php-version: '8.0'
    
    • Removed support for Ubuntu 16.04. Please upgrade to Ubuntu 20.04 or Ubuntu 18.04 environments. #452
    • Removed support for Blackfire v1. Specifying blackfire in tools will now install the latest version of Blackfire CLI v2. #478
    - name: Setup PHP with Blackfire
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.0'
        tools: blackfire
    
    • Removed software-properties-common package from dependencies on self-hosted Linux. This package was used for adding third-party repositories(PPA). Removing this reduces self-hosted first run time from 2-3 minutes to 1-2 minutes.

    • PPAs can now be added by setup-php without any dependencies and the deprecated apt-key. It follows the Debian specification for third-party repositories.

    • Remove use of /etc/lsb-release file, /etc/os-release is used now as it has better support.

    • Fixed a bug where the status file was overwritten after PHP was set up on GitHub runners.

    • Fixed support for php-cs-fixer to parse releases.atom file and install correct latest version. #485

    - name: Setup PHP with php-cs-fixer
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.0'
        tools: php-cs-fixer
    
    • Fixed cache support for extensions on Windows which need additional libraries.
    • Fixed permissions in composer set up on self-hosted environments. #477
    • Fixed starting Blackfire service on Linux. #483
    • Fixed a warning about shallow clones for Homebrew taps on macOS.
    • Fixed a warning about macOS developer mode while using brew cat.
    • In tsconfig.json set lib to ES2020 and target to ES2019 for supporting Node 12 in self-hosted runners.
    • Update Node.js dependencies.

    Thanks! @jrfnl and @lolautruche for the contributions 🎉

    Source code(tar.gz)
    Source code(zip)
  • 1.11.3(Aug 23, 2021)

    v1 maintenance release

    • Added support for extensions mongodb and yaml on macOS using shivammathur/extensions tap.
    • Added --no-install-recommends to apt-get install commands on Linux.
    • Added a specific phive version compatible with PHP 7.2. #481
    • Removed support for Ubuntu 16.04 on setup-php. #452
    • Fixed permissions in composer set up on self-hosted environments. #477
    • Fixed a warning about shallow clones for Homebrew taps on macOS.
    • Fixed a warning about macOS developer mode while using brew cat.
    • Sync tsconfig.json with v2.
    • Update Node.js dependencies.
    Source code(tar.gz)
    Source code(zip)
  • 2.12.0(Jul 14, 2021)

    • Add support to specify major or major.minor versions for tools. Docs, #467
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '7.4'
        tools: php-cs-fixer:3, phpunit:8.5
      env:
        COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    
    • Add a php-version output which can be used in later steps. Docs, #470
    - name: Setup PHP
      id: setup-php
      uses: shivammathur/setup-php@v2
      with:
        php-version: '7.4'
    
    - name: Print PHP version
      run: echo ${{ steps.setup-php.outputs.php-version }}
    
    • Like Ubuntu, add PHP commit hash in PHP 8.1 (nightly) logs on Windows and macOS.
    • Use composer to install composer-require-checker. #473
    • Use shivammathur/extensions tap for rdkafka extension on macOS. shivammathur/homebrew-php#365
    • Support for Ubuntu 16.04 was dropped on August 1, 2021. 📢Announcement: #452
    • Set the Firebird client version to 3.0.7 on macOS.
    • Improve grpc_php_plugin support on Ubuntu and macOS.
    • Minor fixes for self-hosted setup on Ubuntu.
    • Improve PHP setup on macOS to be more resilient to dependency version inconsistencies.
    • Fix to enable extensions disabled with phpdismod on Ubuntu. actions/virtual-environments#3472
    • Fix Imagick setup with shivammathur/cache-extensions action on Windows. #455
    • Fix support for OCI extensions oci8 and pdo_oci. #449
    • Fix to not use system PHP on macOS.
    • Fix support for Imagick for PHP 5.3 to 5.5 on macOS.
    • Fix installing protoc on macOS.
    • Hotfix: Fix permissions of COMPOSER_HOME directory. #477
    • Hotfix: Fix support for phive on PHP 7.2. #481

    Internal

    • Update contributors SVG in README.md to include contributors from setup-php and all related projects.
    • Move tools set up details from tools.ts to tools.json config.
    • Improve error handling in utils.fetch and its uses.
    • Refactor tests for tools using jest.Each.
    • Update Ubuntu 16.04 warning in install.ts.
    • Set sourceMap to true in tsconfig.json.
    • Update Node.js dependencies.
    Source code(tar.gz)
    Source code(zip)
  • 1.11.2(Jul 14, 2021)

    v1 maintenance release

    • Fix replacing v prefix in tool versions.
    • Use shivammathur/extensions tap for rdkafka on macOS.
    • Update Ubuntu 16.04 warning in install.ts.
    • Update Node.js dependencies.
    Source code(tar.gz)
    Source code(zip)
  • 2.11.0(Apr 27, 2021)

    • Improve cache in shivammathur/php-ubuntu for PHP 5.6 to PHP 8.0. Using cache should reduce setup-php runtime on Ubuntu when the PHP version is not installed on the runner or update: true is set from 1-2 minutes to less than 5 seconds.

    • Add support to compile and install extensions from source from any git repository, from a sub-directory in a repository, with required libraries and configuration. Refer to this guide for more details and examples. #418, Closes #419

    • Add support to set up composer packages using tools input. Closes #442

    - name: Setup PHP with tools
      uses: shivammathur/setup-php@v2
      with:
        php-version: '7.4'
        tools: phpunit/phpunit
    
    • Add support to skip composer setup by specifying tools: none. Closes #446
    - name: Setup PHP with no tools using composer
      uses: shivammathur/setup-php@v2
      with:
        php-version: '7.4'
        tools: none
    
    • Add support for different ICU versions with PHP 8.1 on Ubuntu.
    - name: Setup PHP 8.1 with ICU 69.1
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.1'
        extensions: intl-69.1
    
    • Improve logs for compiling extensions from source. Now this process is verbose and the logs are grouped.
    • Improve extension support.
      • Add support for pdo_firebird.
      • Improve support for geos to compile on PHP 8.0 and 8.1.
      • Fix cubrid setup on Ubuntu 16.04.
      • Fix gearman support on Ubuntu.
      • Use GitHub releases for all couchbase versions.
      • Use shivammathur/extensions tap for apcu, phalcon, psr, memcache and memcached on macOS.
      • Fix phalcon3 on Windows.
      • Revert to ppa:ondrej/ppa for phalcon3 on Ubuntu.
      • Revert pcov patch for PHP 8 on Windows as the DLL is now available on PECL.
    • Add PHP commit hash in logs on PHP 8.1 (nightly) on Ubuntu. #433
    • Fix versions in logs of tools installed using composer.
    • Fix linking of old libraries on macOS.
    • Fix enabling cached extensions which have other extensions as dependencies. #428
    • Fix pecl setup to avoid unnecessary callbacks.
    • Fix blackfire extension version to 1.50.0 for PHP 5.6 and below.
    • Fix composer setup on self-hosted set up. #435
    • PHP 5.6 to PHP 7.2 on macOS are now built with backported security patches in shivammathur/php tap.

    Internal

    • Add fallback to Install-Module in Install-PSPackage in win32.ps1.
    • Add parameters to add_ppa function in linux.sh.
    • Do not lowercase source extension input.
    • Fix warning about ignored promise in install.ts.
    • Fix shellcheck warning in darwin.sh.
    • Refactor coverage setup.
    • Refactor regex in extension.ts.
    • Remove dotdeb support. PHP 5.4 and 5.5 are now built from source along with compatable extensions in shivammathur/php5-ubuntu.
    • Replace bintray with cdnjs as fallback to GitHub releases for fetching scripts.
    • Replace bintray in Windows script with GitHub Releases.
    • Replace bintray and use shivammathur/intl-icu GitHub releases.
    • Move patches from custom extension scripts to patches directory.
    • Switch from clover.xml to lcov.info for coverage. clover.xml has broken conditional coverage support.
    • Use add_extension_from_source for all custom supported extensions.
    • Move patches from custom extension scripts to patches directory.
    • Move add_pecl_extension to common.sh.
    • Improve switch_version in linux.sh to accept parameters.
    • Cleanup tsconfig.json.
    • Set moduleResolution to node in tsconfig.json.
    • Update year in license.
    • Update Node version to 15.x in Node workflow.
    • Update SECURITY.md.
    • Update Node.js dependencies.
    Source code(tar.gz)
    Source code(zip)
  • 2.10.0(Feb 23, 2021)

    • Add support to compile extensions from source. Docs (#399).
    - name: Setup PHP with mongodb compiled from source
      uses: shivammathur/setup-php@v2
      with:
        php-version: '7.4'  
        extensions: mongodb-mongodb/[email protected]
    
    • Add support to setup Xdebug 2.x on PHP 7.2 to PHP 7.4. Docs.
    name: Setup PHP with Xdebug 2.x
    uses: shivammathur/setup-php@v2
    with:
      php-version: '7.4'
      coverage: xdebug2
    
    • Add support for quoted CSV in ini-values to allow directives with commas (#392, #405).
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.0'
        ini-values: xdebug.mode="develop,coverage"
    
    • Add support to specify version in d.x notation. For example 5.x, 7.4 and 8.x (#395).
    - name: Setup PHP 7.4
      uses: shivammathur/setup-php@v2
      with:
        php-version: '7.x'
    
    • Add support for specifying ICU version for intl extension on PHP 8.0 (shivammathur/icu-intl#1).
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.0'
        extensions: intl-68.2
    
    • Add support for pdo_firebird for all configurations.
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.0'
        extensions: pdo_firebird
    
    • Add support for self-hosted runners on macOS ARM64 Docs.
    • Add support for blackfire on PHP 8.0.
    - name: Setup PHP with blackfire
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.0'
        extensions: blackfire
        tools: blackfire
    
    • Add support for pecl_http for all PHP versions on Ubuntu and macOS and PHP 7.1 to PHP 8.0 on Windows. (#396)
    - name: Setup PHP with pecl_http
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.0'
        extensions: pecl_http
    
    • Add support for aliases for symfony-cli, vapor-cli, and wp-cli. Docs
    • Add support for couchbase extension with PHP 5.3 to PHP 5.5 on Ubuntu and macOS.
    • Fail fast on failing to setup the requested PHP version (#368).
    • Fix Composer config syntax (#404).
    • Fix PHP 8 on macOS after update on images.
    • Fix PDO extensions setup on Ubuntu and macOS (#412).
    • Fix compiling extensions in self-hosted workflows (shivammathur/node-docker#5).
    • Fix tools setup on self-hosted runners.
    • Fix pcov on PHP 8.0 on Windows (#398).
    • Fix cache support for cubrid and pdo_cubrid.
    • Fix support for phalcon3 (#413).
    • Improve support for PHP extensions amqp, igbinary, imap, msgpack, propro, raphf, redis and zmq on macOS.
    • Improve support for phive. Now the correct version of phive for the PHP version should be setup (#366).
    • Improve fetching homebrew taps.
    • Improve PECL support. It is no longer required to specify pecl in tools input.
    • Improve regexes in extensions.ts.
    • Improve logs in Symfony examples (#377).
    • Set up Codeception using Composer.
    • Change Node.js version in the workflow.
    • Update Node.js dependencies.

    Thanks @dingo-d, @alcaeus, @smoqadam and @glensc for the contributions 🎉

    Source code(tar.gz)
    Source code(zip)
  • 2.9.0(Nov 26, 2020)

    • PHP 8.0 is now stable PHP 8.0.0 on setup-php for all supported OS. 🥳
    • Add new JIT configuration section to the README.

    For example, to enable JIT on PHP 8.0.

    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.0'
        ini-values: opcache.enable_cli=1
    

    Refer to JIT Configuration for more details.

    • Skip prestissimo and composer-prefetcher unless composer:v1 is specified.

    For example to setup prestissimo, use

    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.0'
        tools: composer:v1, prestissimo
    
    • Set Xdebug version to 2.9.8 on PHP 7.2. #345
    • Set xdebug.mode=coverage ini directive always #346
    • Sync dependencies from shivammathur/extensions tap in add_brew_extension.
    • Fix fail-fast on Windows.
    • Fix deleting extensions when one extension is a substring of the other. For example pdo_sqlsrv and sqlsrv.
    • Fix fetching extension version from PECL on macOS.
    • Fix fetching grpc latest tag. (grpc/grpc.io#79)
    • Prioritize Bintray over GitHub releases for fetching scripts.
    • Refactor darwin.sh script.
    • Change project description in actions.yml.
    • Bump version to 2.9.0

    Thanks @owenvoke for the contribution 🎉

    Source code(tar.gz)
    Source code(zip)
  • 1.11.1(Apr 27, 2021)

    v1 maintenance release

    • Add fallback to Install-Module in Install-PSPackage in win32.ps1.
    • Add parameters to add_ppa function in linux.sh.
    • Cleanup cleanup_lists in linux.sh.
    • Fix gearman support on Ubuntu.
    • Fix warning about ignored promise in install.ts.
    • Fix linking of old libraries on macOS.
    • Make sure global composer.json directory exists.
    • PHP 5.6 to PHP 7.2 on macOS are now built with backported security patches in shivammathur/php tap.
    • Revert pcov patch for PHP 8 on Windows as the DLL is now available on PECL.
    • Update Node version to 15.x.
    • Update SECURITY.md.
    • Switch from clover.xml to lcov.info for coverage. clover.xml has broken conditional coverage support.
    • Use packages from shivammathur/php-ubuntu for PHP setup and upgrades.
    • Use shivammathur/extensions for phalcon and psr.
    Source code(tar.gz)
    Source code(zip)
  • 1.11.0(Feb 23, 2021)

    v1 maintenance release

    • Add support to setup Xdebug 2.x on PHP 7.2 to PHP 7.4. Docs
    name: Setup PHP with Xdebug 2.x
    uses: shivammathur/setup-php@v1
    with:
      php-version: '7.4'
      coverage: xdebug2
    
    • Add support for quoted CSV in ini-values input to allow directives with commas.
    name: Setup PHP
    uses: shivammathur/setup-php@v1
    with:
      php-version: '7.4'
      ini-values: xdebug.mode="develop,coverage"
    
    • Add support to specify version in d.x notation. For example 5.x, 7.4 and 8.x.
    name: Setup PHP 7.4
    uses: shivammathur/setup-php@v1
    with:
      php-version: '7.x'
    
    • Fail fast on failing to setup the requested PHP version.
    • Fix Composer config syntax.
    • Fix PHP 8 on macOS.
    • Improve support for PHP extensions amqp, igbinary, imap, msgpack, pecl_http, propro, raphf, redis and zmq on macOS.
    • Improve support for phive.
    • Improve fetching homebrew taps.
    • Improve regexes in extensions.ts.
    • Improve PECL support. It is no longer required to specify pecl in tools input.
    • Set up Codeception using Composer.
    • Sync Symfony examples from v2.
    • Sync HOMEBREW parameters from v2.
    • Change Node.js version in the workflow.
    • Update Node.js dependencies.
    Source code(tar.gz)
    Source code(zip)
  • 2.8.0(Nov 20, 2020)

    • Add support to setup a specific Composer version. For example to setup Composer 2.0.6.
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '7.4'
        tools: composer:2.0.6
    
    • Add support for couchbase extension for PHP 5.6 to PHP 7.4.
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '7.4'
        extensions: couchbase
    
    • Set blackfire-player to v1.9.3 for PHP 5.5 to PHP 7.0.
    • Set composer version to v1 when prestissimo or composer-prefetcher is specified in tools. It is recommended to stop using prestissimo as Composer 2 is faster on its own.
    • Document using setup-php on i386 and amd64 containers using spc. Docs. Closes #326.
    • Add workflow to document extensions that are enabled by default on wiki. (#327)
    • Fix tools setup when latest release does not have the tool in release assets. Will now fetch tool from the previous release till it is added to the latest release.
    • Improve regex for pre-release PECL extensions. (#325)
    • Install VcRedist from GitHub on Windows.
    • Update PHP dependencies as per GitHub Action runner version on macOS.
    • Fix grpc_php_plugin setup. Now uses Xcode 11.7 as compiling it with Xcode 12 is flaky.
    • Fix extension setup on PHP 8.0 and PHP 8.1 and for all PHP versions on self-hosted Linux.
    • Fix composer setup when it is a dependency of a tool.
    • Revert back to apt-fast as after 1.9.10 release it reports correct exit codes.
    • Revert back to using dashes in step-ids as issue parsing them is fixed upstream (nektos/act#287).
    • Use GitHub releases(s3) as primary source for builds and scripts with bintray only as fallback. This will scale setup-php better and avoid bintray's 2TB/month download limit.
    • Refactor and dry linux.sh and darwin.sh.
    • Fix contribution docs.

    Thanks @GrahamCampbell and @mlocati for the contributions 🎉

    Source code(tar.gz)
    Source code(zip)
Owner
Shivam Mathur
Creator of @setup-php
Shivam Mathur
This is a collection of tutorials for learning how to use Docker with various tools. Contributions welcome.

Docker Tutorials and Labs At this time we are not actively adding labs to this repository. Our focus is on training.play-with-docker.com where new lab

Docker 11.1k Jan 2, 2023
GitHub Actions for Magento 2 Extensions

GitHub Actions for Magento 2 Extensions This repository's aim is to provide a set of open sourced GitHub actions to write better tested Magento 2 exte

ExtDN 104 Jan 1, 2023
Laragon MultiPHP per App + PECL Module + Extension manager + Ini Manager

LMPA Laragon MultiPHP per App This tools allow you to run multiple PHP version per app with Laragon, so you can have multiple site running different p

Gilbert Paquin 8 Oct 10, 2022
Buat yang lagi nyari web cafe yang simple untuk mengelola transaksi jual-beli mungkin repo ini tepat

Buat yang lagi nyari web cafe yang simple untuk mengelola transaksi jual-beli mungkin repo ini tepat. Aplikasi ini juga bisa digunakan buat kamu yang lagi belajar React Js dan REST API

Khasrul 11 Aug 19, 2022
Naive Bayes works by looking at a training set and making a guess based on that set.

Naive Bayes Naive Bayes works by looking at a training set and making a guess based on that set. It uses simple statistics and a bit of math to calcul

Assisted Mindfulness 29 Nov 27, 2022
Set of classes and tools to communicate with a Noso wallet using NosoP

NosoPHP Set of classes and tools to communicate with a Noso wallet using NosoP(Noso Protocol) Examples Node Info include __DIR__ . '/vendor/autoload.p

Noso Project 1 Jan 10, 2022
Run your WP site on github pages, php innovation award winner https://www.phpclasses.org/package/12091-PHP-Make-a-WordPress-site-run-on-GitHub-pages.html

Gitpress Run wordpress directly on github pages Gitpress won the innovation award for may 2021 Read more about this https://naveen17797.github.io/gitp

naveen 13 Nov 18, 2022
Set of front-end tools for Magento 2 based on Gulp.js

Magento 2 Frontools Set of front-end tools for Magento 2 Requirements Unix-like OS (please, do not ask about Windows support) Node.js LTS version. We

SNOW.DOG 433 Dec 6, 2022
Hook-logger-plugin - Debug WordPress action / filter hooks.

hook-logger-plugin Easily debug WordPress action / filter hooks, finding where actions are called from and understanding the flow of execution. This p

bruce aldridge 4 Feb 5, 2022
↪️🔔 Send notification action for Nextcloud Flow

Nextcloud Flow Notifications ?? Notification action for Nextcloud Flow ?? Configure your flow ?? Receive notifications ?? Development setup ☁ Clone th

Nextcloud 13 Dec 2, 2022
JSON schema models and generated code to validate and handle various data in PocketMine-MP

DataModels JSON schema models and generated code to validate and handle various data in PocketMine-MP This library uses php-json-schema-model-generato

PMMP 2 Nov 9, 2022
StickWithIt is an online food ordering website created using PHP. You can view and purchase various items as well as remove items from the cart.

StickWithIt (App Name) StickWithIt is an online food ordering website created using PHP. The database used here is MYSQL database. The tool used here

Jenil Gajjar 1 May 11, 2022
Prepare your Laravel apps incredibly fast, with various commands, services, facades and boilerplates.

Grafite Builder Grafite has archived this project and no longer supports or develops the code. We recommend using only as a source of ideas for your o

Grafite Inc 997 Dec 22, 2022
Melek Berita Backend is a service for crawling data from various websites and processing the data to be used for news data needs.

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Chacha Nurholis 2 Oct 9, 2022
This project backports features found in the latest PHP versions and provides compatibility layers for some extensions and functions

This project backports features found in the latest PHP versions and provides compatibility layers for some extensions and functions. It is intended to be used when portability across PHP versions and extensions is desired.

Symfony 2.2k Dec 29, 2022
A PHP library to convert text to speech using various services

speaker A PHP library to convert text to speech using various services

Craig Duncan 98 Nov 27, 2022
It's goal is to create my own platform where I can play various board games I like.

Card games The goal of this project is to create a social platform where players can communicate, create lobbies and play various board games. Current

Ondřej Mastík 2 Oct 29, 2021
Learning design patterns by implementing them in various programming languages.

design-patterns Learning design patterns by implementing them in various programming languages. Creational design patterns Creational design patterns

Paweł Tryfon 1 Dec 13, 2021
Various PHPStan rules we found useful in ShipMonk.

ShipMonk PHPStan rules Various rules we found useful in ShipMonk. You may found some of them opinionated, so we recommend picking only those fitting y

ShipMonk R&D 31 Dec 22, 2022