Fake Compose PHP Version

When working on a project it's important to always keep your development environment as close to production as possible. If your production environment is on an older version of PHP it's important that you use the same version in development.

If you work on multiple projects at the sametime this will mean that you need to remember that in development and use the correct PHP version for the project you're working on.

There are many ways of doing this like setting up your own docker image that you can use with composer to install the correct versions of your dependencies, but what if you're also working on a project with people who aren't comfortable with using docker.

You need an easy way you can have multiple people working on a project and make sure that you restrict your dependencies to only use packages that will be valid with production.

To do this you can tell composer what version of PHP you want to get dependencies for, even if it's a different version to your install PHP version.

You do this by adding a config to composer for the platform to use.

"config": {
    "platform": {
        "php": "7.0.2"

This will force composer to only download packages that are compatitble with PHP version 7.0.2 and not higher.


Reliable uptime monitoring and instant alerts for any website downtime.

Get 50% off forever using the code 50OFFUP.