Skip to content
Advertisement

How to always use ignore-platform-reqs flag when running composer?

On my local machine, I have php v7.0.3. A project of mine has a dependency on php v5.5.

So as expected, a simple run of composer install crashes:

JavaScript

I know I can ignore the platform via:

JavaScript

yet I often forget to add the flag. Yet since the application runs inside a docker container, a mismatching php can install the dependencies just as fine.

So I am wondering if there is a way to make my local composer always assume --ignore-platform-reqs in order to not having to type it.

I like to avoid setting an alias and have it work on composer config level.

Advertisement

Answer

It’s recommended to fake php version, rather than ignore platform requirements. Add

JavaScript

to your ~/.composer/config.json or use composer config -g -e to edit it.

An example of sufficient config to fake php version:

JavaScript

It may have much more options though.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement