setup-php by passing inputs via the with: keyword in your workflow step. All inputs are optional — you can use as few or as many as your project requires.
The PHP version to set up. Accepts a version string like
If omitted,
'8.5', or one of the following special values:| Value | Behavior |
|---|---|
lowest | Sets up the lowest supported PHP version |
highest or latest | Sets up the latest stable PHP version |
nightly | Sets up a nightly build from the PHP master branch |
pre-installed | Uses the highest pre-installed PHP version on the runner |
d.x | Sets up the latest release for a given major, e.g. 8.x |
setup-php reads the version from php-version-file, then composer.lock, then composer.json. If none are found, the latest stable version is used.Specifying
8.6 installs a nightly build of PHP 8.6.0-dev from the master branch. These builds are in active development and may contain bugs or breaking changes.Path to a file containing the PHP version to set up. Useful for version-pinning via a checked-in file.Accepts any file that either contains a bare PHP version string or follows the asdf
.tool-versions format.Defaults to .php-version in the repository root. If php-version is also set, it takes precedence over this input. If the default .php-version file is not found and this input is not set, the latest stable PHP version is used.A comma-separated list of PHP extensions to install or disable.
- Prefix an extension with
:to disable it. - Specify
noneto disable all shared extensions. When combined with other extensions,noneis processed first — all shared extensions are disabled, then the remaining entries are installed. - Suffix an extension name with a version to install a specific PECL release, e.g.
swoole-1.9.3. - Suffix with a stability flag (
alpha,beta,devel,snapshot) to install a pre-release version, e.g.xdebug-beta.
The base
php.ini file to use. Accepts production, development, or none.| Value | Behavior |
|---|---|
production | Uses the production php.ini template (default) |
development | Uses the development php.ini template |
none | Starts with an empty php.ini |
A comma-separated list of
key=value pairs to add to php.ini.Values that contain commas must be wrapped in quotes, e.g. xdebug.mode="develop,coverage".The code coverage driver to set up. Accepts
xdebug, xdebug2, pcov, or none.| Value | Behavior |
|---|---|
xdebug | Installs the latest Xdebug compatible with the PHP version and disables PCOV |
xdebug2 | Installs Xdebug 2.x — use for PHP 7.2, 7.3, and 7.4 |
pcov | Installs PCOV and disables Xdebug — requires PHP 7.1+ |
none | Disables both Xdebug and PCOV |
A comma-separated list of tools to install globally. Accepts tool names,
vendor/package Packagist references, versioned entries like tool:1.2.3, or none to skip all tools including composer.Supported tools include: composer, phpunit, phpstan, psalm, php-cs-fixer, phpcs, phpmd, rector, infection, deployer, symfony, wp-cli, and many more.The
tools input is useful for CI-only tools, keeping your composer.json tidy. Use --no-dev with composer and install required tools via tools to speed up your workflow.A GitHub token used for authentication when installing tools and extensions. Defaults to the
GITHUB_TOKEN secret automatically provided by GitHub Actions.Set this to a Personal Access Token (PAT) if you need elevated permissions or if you are on GitHub Enterprise, where GITHUB_TOKEN is not used as the default.The
COMPOSER_TOKEN and GITHUB_TOKEN environment variables are deprecated in favor of this input and will be removed in the next major version.