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.
string
The PHP version to set up. Accepts a version string like
'8.5', or one of the following special values:If omitted,
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.string
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.string
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.
string
default:"production"
The base
php.ini file to use. Accepts production, development, or none.string
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".string
The code coverage driver to set up. Accepts
xdebug, xdebug2, pcov, or none.string
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.string
default:"${{ github.token }}"
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.