Skip to content
Latchkey

Composer "requires php >=X but your php version does not satisfy"

A package (or your own require block) declares a PHP version constraint, and the PHP interpreter Composer is using falls outside it. Composer will not install a set that cannot run on this interpreter.

What this error means

Composer aborts during solving, noting a package requires a PHP version your runtime does not satisfy. php -v on the runner shows a version outside the package’s supported range.

composer output
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/framework[v11.0.0, ...] require php ^8.2 -> your php version
      (8.0.30) does not satisfy that requirement.

Common causes

The runner PHP is older than the package needs

Modern releases drop old PHP versions. On PHP 8.0 a package requiring ^8.2 is rejected, and Composer cannot resolve the set.

The runner PHP is newer than the package supports

Some packages cap their upper bound. On a brand-new PHP they have no compatible release, so the constraint cannot be met.

How to fix it

Pin the PHP version in CI

Select an interpreter that sits inside every dependency’s supported range.

.github/workflows/ci.yml
- uses: shivammathur/setup-php@v2
  with:
    php-version: '8.3'
- run: php -v

Confirm which PHP Composer is actually using

  1. Run php -v and composer --version in the same step.
  2. If which php points at an unexpected binary, your PATH is wrong.
  3. Check config.platform.php in composer.json is not pinning an older version than the runtime.

How to prevent it

  • Declare a "php" constraint in your own composer.json so consumers get a clear error.
  • Test against the exact PHP versions you support in a CI matrix.
  • Keep config.platform.php aligned with the PHP you actually deploy on.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →