Skip to content

/flags/composer/composer-ignore-platform-req

composer install --ignore-platform-req=php: skip one PHP or extension check

The commands on this page have not been executed by our verification runner yet.updated
tool
Composer
command
composer install, composer update, composer require
flag
--ignore-platform-req=NAME, --ignore-platform-reqs
default
off (PHP version, extensions and libraries are checked)

Composer checks platform requirements before installing: the PHP version (php), extensions (ext-intl, ext-gd) and system libraries (lib-*) that packages declare. When the machine running Composer does not satisfy them, the install stops with "Your requirements could not be resolved to an installable set of packages" or "Your lock file does not contain a compatible set of packages". --ignore-platform-req=ext-intl skips one of those checks; --ignore-platform-reqs (plural) skips all of them.

Common forms

bash
composer install --ignore-platform-req=ext-intl        # one extension
composer install --ignore-platform-req=ext-*           # every extension (wildcard)
composer install --ignore-platform-req=php+            # only the upper bound of php
composer install --ignore-platform-reqs                # everything (last resort)
COMPOSER_IGNORE_PLATFORM_REQ=ext-intl composer install # environment variable form

Options compared

OptionIgnoresTypical case
--ignore-platform-req=ext-NAMEOne extensionBuild container lacks an extension the runtime image has
--ignore-platform-req=phpThe PHP version constraintTesting a newer PHP before packages declare support
--ignore-platform-req=php+Only the upper bound of phpPackage says ^7 but works on PHP 8
--ignore-platform-req=ext-*All extensionsComposer-only image used to fill vendor/
--ignore-platform-reqsPHP, extensions and librariesAvoid; hides real incompatibilities
config.platform in composer.jsonNothing: pretends a fixed platformBuild machine differs from production

Better: declare the target platform

json
{
  "config": {
    "platform": {
      "php": "8.3.0",
      "ext-intl": "1.0"
    }
  }
}

With config.platform, Composer resolves packages for PHP 8.3 with intl on every machine, so the lock file fits production even when developers run another PHP version. Nothing is ignored; Composer simply knows what to target.

Pitfalls

FAQ

What is the difference between --ignore-platform-req and --ignore-platform-reqs?

--ignore-platform-reqs (plural) ignores every platform requirement: PHP, all extensions and libraries. --ignore-platform-req=NAME (singular, repeatable, wildcards allowed) ignores only the named one, which keeps the other checks working.

What does the + in --ignore-platform-req=php+ mean?

It ignores only the upper bound. A package requiring php ^7 can then be installed on PHP 8, but installing on PHP 5.6 still fails because the lower bound is still checked.

Is config.platform better than the flag?

When the build machine differs from production, yes. Setting config.platform.php to the production version makes Composer resolve for that version on every machine, without ignoring anything.

Sources