Composer with Dockerized Infrastructure: Force Composer to ignore the system requirments on your host

When you are using composer for installing projects that are running inside Docker containers composer might refuse to continue with the installation because it cannot find all all system requirements on your host.
created by on 2015-07-04

Screenshot: The result of a composer update were the PHP version requirments are not met

Your composer.json could contain a requirement for PHP version ≥ 5.6 and you only have PHP 5.5.x installed on your host:

{
  ...
  "require": {
    "php": ">=5.6"
  }
}
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - This package requires php >=5.6 but your PHP version (5.5.20) does not satisfy that requirement.

But you know that you don’t need the required components (e.g. a specific PHP version) on your system because your project is running inside a Docker container that meets all the requirements of the project.

In that case you can use the –ignore-platform-reqs option for composer:

composer update --ignore-platform-reqs

Screenshot: composer update with ignore platform requirements option

Tags: