Quick Start
Get PHP set up in your GitHub Actions workflow in minutes.
PHP Versions
Support for PHP 5.3 through 8.6 including nightly builds.
Extensions
Install PHP extensions from PECL, packages, or git repositories.
Tools
Set up 50+ PHP tools globally including PHPUnit, PHPStan, and Composer.
What is setup-php?
setup-php is a GitHub Action that provides a cross-platform interface to configure PHP environments in your CI/CD workflows. It supports Ubuntu, Windows, and macOS — both GitHub-hosted and self-hosted runners.
Key capabilities
Cross-platform
Works on Ubuntu, Windows, and macOS runners. Handles differences automatically.
PHP 5.3 to 8.6
Set up any PHP version from 5.3 to the latest nightly build of 8.6.
Extension management
Add, remove, or disable PHP extensions. Supports PECL, packages, and source builds.
Coverage drivers
Configure Xdebug or PCOV for code coverage, or disable coverage to speed up tests.
50+ tools
Install PHPUnit, PHPStan, Psalm, php-cs-fixer, Rector, and many more globally.
Composer integration
Authenticates with GitHub, Private Packagist, and custom package registries.
Platform support
Get started
1
Add the action to your workflow
Add
shivammathur/setup-php@v2 to your .github/workflows/*.yml file.2
Choose your PHP version
Set
php-version to any version from 5.3 to 8.6, or use latest for the newest stable release.3
Add extensions and tools
Use the
extensions and tools inputs to install what your project needs.4
Run your tests
Your PHP environment is ready — run PHPUnit, static analysis, or any other CI steps.
See the quickstart guide
A complete working workflow example to get you started in under 5 minutes.