0

The constraint that I am interested in is

"require":{ "php": "..."

Is there a way to target php 7.1 for the project packages in composer.json even though I'm running 7.2 when I call composer update/install on the command line?

1 Answer 1

1

You can use platform configuration from Composer: https://getcomposer.org/doc/06-config.md#platform

Basically, your composer.json would look like this:

{
    "require": {
        ...
    },
    "config": {
        "platform": {
            "php": "7.1"
        }
    }
}

This will make sure that you install only packages compatible with PHP 7.1, no matter which PHP version you use to actually install the packages.

2
  • One of my least favourite parts of programming is estimating. I can't even begin to estimate how much time you saved me! Thanks a million!
    – Tarek Adam
    Commented Apr 25, 2018 at 16:36
  • I'm glad I helped :) Commented Apr 25, 2018 at 18:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.