Skip to main content

Migrate from setup-php

Many PHP workflows use shivammathur/setup-php on ubuntu-latest runners. php-ci moves PHP, extensions and Composer into the container image, so jobs become shorter and more reproducible.

Before — setup-php on the host

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: mbstring, intl, pdo_mysql
coverage: pcov
- run: composer install --no-interaction
- run: ./vendor/bin/phpunit

After — php-ci container

jobs:
test:
runs-on: ubuntu-latest
container:
image: himanshuramavat/php-ci:8.3
steps:
- uses: actions/checkout@v4
- run: composer install --no-interaction --prefer-dist
- run: ./vendor/bin/phpunit

Extensions bundled in php-ci are listed in PHP Extensions. Remove redundant extensions: entries from setup-php — they are already in the image.

Matrix migration

Replace php-version matrix keys with image tags:

strategy:
matrix:
include:
- image: himanshuramavat/php-ci:8.2
- image: himanshuramavat/php-ci:8.3
- image: himanshuramavat/php-ci:8.4
jobs:
test:
runs-on: ubuntu-latest
container:
image: ${{ matrix.image }}
steps:
- uses: actions/checkout@v4
- run: composer install --no-interaction --prefer-dist
- run: ./vendor/bin/phpunit

GitLab CI

Replace image: php:8.3 plus before-script extension installs with a single php-ci tag — see GitLab CI.

When to keep setup-php

  • You need a PHP extension not in php-ci and cannot extend the image
  • Your org standardizes on GitHub-hosted tools outside Docker

For most TYPO3, Laravel and library projects, php-ci covers the same surface area with less YAML.