Skip to content
Latchkey

Composer "requires php >=8.x -> your php version does not satisfy that requirement" in CI

A package (directly or transitively) requires a newer PHP than the runner provides. Composer reports the required constraint and the runner PHP it detected, then refuses to install.

What this error means

composer install fails with a Problem block: "requires php >=8.2 -> your php version (8.1.x) does not satisfy that requirement".

Composer
  Problem 1
    - symfony/console v7.0.0 requires php >=8.2 -> your php version (8.1.27)
      does not satisfy that requirement.

Diagnose it: platform requirements and auth

Composer resolves against the PHP version and extensions actually present, so a lockfile that installs locally can be unsatisfiable on a runner with a different PHP build.

Terminal
php -v && php -m | head -30
composer diagnose
composer check-platform-reqs

# install exactly what is locked, non-interactively
composer install --no-interaction --prefer-dist --no-progress

Common causes

The CI runner PHP is older than the dependency needs

The default or pinned PHP on the runner predates the version a package requires, so Composer excludes that package.

A transitive dependency bumped its minimum PHP

An upgrade pulled in a release that raised its php requirement above the runner interpreter.

How to fix it

Pin the runner PHP with setup-php

  1. Read the "requires php >=X" line to see the minimum needed.
  2. Set that PHP version with shivammathur/setup-php before composer runs.
  3. Re-run so the interpreter satisfies the constraint.
.github/workflows/ci.yml
- uses: shivammathur/setup-php@v2
  with:
    php-version: '8.2'

Or hold the dependency at a PHP-compatible version

If you must stay on the older PHP, pin the package to the last release that still supports it.

Terminal
composer require symfony/console:^6.4

How to prevent it

  • Pin the runner PHP explicitly with setup-php, not the image default.
  • Match your composer.json "php" constraint to the runner version.
  • Review PHP requirement bumps when upgrading major dependencies.

Frequently asked questions

What causes Composer "requires php >=8.x -> your php version does not satisfy that requirement" in CI?
There are 2 common causes: the ci runner php is older than the dependency needs and a transitive dependency bumped its minimum php. The default or pinned PHP on the runner predates the version a package requires, so Composer excludes that package.
How do I fix Composer "requires php >=8.x -> your php version does not satisfy that requirement" in CI?
There are 2 fixes depending on which cause you have: pin the runner php with setup-php and or hold the dependency at a php-compatible version. Work through them in order, since the first is the most common.
What does Composer "requires php >=8.x -> your php version does not satisfy that requirement" in CI actually mean?
composer install fails with a Problem block: "requires php >=8.2 -> your php version (8.1.x) does not satisfy that requirement".
How do I stop Composer "requires php >=8.x -> your php version does not satisfy that requirement" in CI happening again?
Pin the runner PHP explicitly with setup-php, not the image default. The prevention section lists 3 changes that keep it from recurring.

Related guides

References

Not every red build is your code. Latchkey repairs the ones that are not, on the runner. Start free → 30-day trial · No credit card