Skip to content
This repository was archived by the owner on Mar 25, 2022. It is now read-only.

Adding Platform Config to composer.json

Aaron Zinck edited this page Oct 2, 2019 · 2 revisions

About Platform Config

Composer's config.platform option is used to tell Composer about the PHP environment that the packages will be running in. This differs from the current environment since we use a Composer-specific image to perform composer install commands. The config.platform option allows us to tell Composer about the platform dependencies without specifying --ignore-platform-reqs.

The structure of the platform config is "ext-<extension>": "<version". Composer doesn't seem to care about the version number for built-in extensions, so we just use "1.0.0" everywhere.

Updating Your composer.json

  1. First, update the file (see the two sections below for what config you should add).
  2. Run composer update --lock. Composer will capture the platform config.
  3. Make sure the update has not introduced any breaking changes.
  4. Commit and push. You can now freely forget that --ignore-platform-reqs exists.

Drupal

For Drupal projects, you'll need to advertise three extensions: GD, Opcache, and PDO:

{
    "config": {
        "platform": {
            "ext-gd": "1.0.0",
            "ext-opcache": "1.0.0",
            "ext-pdo": "1.0.0"
        }
    }
}

WordPress

WordPress only requires the MySQLi extension:

{
    "config": {
        "platform": {
            "ext-mysqli": "1.0.0"
        }
    }
}

Further Reading

Clone this wiki locally