> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/shivammathur/setup-php/llms.txt
> Use this file to discover all available pages before exploring further.

# setup-php

> GitHub Action to set up PHP with extensions, php.ini configuration, coverage drivers, and tools for your CI/CD workflows.

<CardGroup cols={2}>
  <Card title="Quick Start" icon="rocket" href="/quickstart">
    Get PHP set up in your GitHub Actions workflow in minutes.
  </Card>

  <Card title="PHP Versions" icon="code" href="/features/php-versions">
    Support for PHP 5.3 through 8.6 including nightly builds.
  </Card>

  <Card title="Extensions" icon="puzzle-piece" href="/features/extensions">
    Install PHP extensions from PECL, packages, or git repositories.
  </Card>

  <Card title="Tools" icon="wrench" href="/features/tools">
    Set up 50+ PHP tools globally including PHPUnit, PHPStan, and Composer.
  </Card>
</CardGroup>

## 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.

```yaml theme={null}
- name: Setup PHP
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.4'
    extensions: mbstring, intl, pdo_mysql
    ini-values: post_max_size=256M, max_execution_time=180
    coverage: xdebug
    tools: composer, phpunit
```

## Key capabilities

<CardGroup cols={2}>
  <Card title="Cross-platform" icon="display">
    Works on Ubuntu, Windows, and macOS runners. Handles differences automatically.
  </Card>

  <Card title="PHP 5.3 to 8.6" icon="layer-group">
    Set up any PHP version from 5.3 to the latest nightly build of 8.6.
  </Card>

  <Card title="Extension management" icon="plug">
    Add, remove, or disable PHP extensions. Supports PECL, packages, and source builds.
  </Card>

  <Card title="Coverage drivers" icon="chart-bar">
    Configure Xdebug or PCOV for code coverage, or disable coverage to speed up tests.
  </Card>

  <Card title="50+ tools" icon="toolbox">
    Install PHPUnit, PHPStan, Psalm, php-cs-fixer, Rector, and many more globally.
  </Card>

  <Card title="Composer integration" icon="box">
    Authenticates with GitHub, Private Packagist, and custom package registries.
  </Card>
</CardGroup>

## Platform support

| Platform                   | GitHub-hosted | Self-hosted |
| -------------------------- | :-----------: | :---------: |
| Ubuntu 22.04 / 24.04       |       ✓       |      ✓      |
| Windows Server 2022 / 2025 |       ✓       |      ✓      |
| macOS 14 / 15 / 26         |       ✓       |      ✓      |
| Debian 11 / 12 / 13        |       —       |      ✓      |

## Get started

<Steps>
  <Step title="Add the action to your workflow">
    Add `shivammathur/setup-php@v2` to your `.github/workflows/*.yml` file.
  </Step>

  <Step title="Choose your PHP version">
    Set `php-version` to any version from `5.3` to `8.6`, or use `latest` for the newest stable release.
  </Step>

  <Step title="Add extensions and tools">
    Use the `extensions` and `tools` inputs to install what your project needs.
  </Step>

  <Step title="Run your tests">
    Your PHP environment is ready — run PHPUnit, static analysis, or any other CI steps.
  </Step>
</Steps>

<Card title="See the quickstart guide" icon="arrow-right" href="/quickstart">
  A complete working workflow example to get you started in under 5 minutes.
</Card>
