Force Composer to require/fake a specific PHP version

If you are developing with the newest PHP and are running production with a very outdated version you will find useful the fake platform feature of Composer (the perfect solution would consist to use the same platform on your development, staging and production servers).


Lets you fake platform packages (PHP and extensions) so that you can emulate a production env or define your target platform in the config.

Using the following snippet in composer.json, a php version can be simulated:

"config": {
    "platform": {
        "php": "5.5.1"

Remember to update often and maintain awareness of the latest versions and their changes!

Most recent

Most voted


  1. Pingback: Faking PHP version for Composer – tomsihap

Leave a Reply

Your email address will not be published. Required fields are marked *