How to limit a package's dependency to a certain PHP version in Composer? - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Wednesday, January 26, 2022

How to limit a package's dependency to a certain PHP version in Composer?

Our production server is PHP 5.5.24. A package I need (vlucas/dotenv) requires in its composer.json:

"symfony/polyfill-ctype": "^1.17"

Unfortunately version 1.20 of that symfony package requires 7.1, which causes Composer's platform check to fail. I cannot ignore the error/platform check because it results in a syntax error on PHP 5.5.

It seems that this does not work for sub-dependencies, just the package itself:

"config": {
    "platform": {
        "php": "5.5.24"
    }
}

I've completely deleted the vendor folder and done a fresh install. Upgrading the server is not an option.



source https://stackoverflow.com/questions/70853617/how-to-limit-a-packages-dependency-to-a-certain-php-version-in-composer

No comments:

Post a Comment