Composer: [Feature request] replaced-by key

Created on 21 Dec 2017  ·  3Comments  ·  Source: composer/composer

Some packages, like symfony/polyfill-mbstring do things only if an extension like ext-mbstring is missing. I think a configuration key that would act as the inverse of replaces could be useful in that kind of case.

Most helpful comment

@javiereguiluz you're right, it should probably not be that simple. I think it could look like this:

    "name": "symfony/polyfill-php56",
    "replaced-by": {
        "php": ">=7.0"
    }

or

    "name": "symfony/polyfill-mbstring",
    "replaced-by": {
        "ext-mbstring": "*"
    }

All 3 comments

How would this work for packages like symfony/polyfill-php56 where the install rule is: "ignore this package if PHP version is PHP 5.6 or higher".

@javiereguiluz you're right, it should probably not be that simple. I think it could look like this:

    "name": "symfony/polyfill-php56",
    "replaced-by": {
        "php": ">=7.0"
    }

or

    "name": "symfony/polyfill-mbstring",
    "replaced-by": {
        "ext-mbstring": "*"
    }

Closing as I don't think this is likely to happen. It's too complex for what it brings IMO, installing a bit of code that's not needed isn't the worst problem.

Was this page helpful?
0 / 5 - 0 ratings