使用php71模拟php70的环境是可能的吗?

I've installed version 7.1 of php. I am developing a library that may work on different php version. I want to run ...

composer install

simulating an environment with php70. The purpose is to avoid php packages in composer.lock that require php71. Is it possibile?

Add something like:

"config": {                                                                       
    "platform": {                                                                
        "php": "~7.0.0"
    }
}

into your composer.json. This should fix the platform for dependency libs.

More info to be found here: Force composer to require PHP Version between Version X and Version Y

Yes it's possible. You have to download composer.phar in you repository. Then you launch it with the php binary 7.0 or 7.1.

/usr/bin/php70 ~/work/composer.phar install

or

/usr/bin/php71 ~/work/composer.phar install

And you can configure your script to use php 7.0 or php 7.1

I hope it will help you

Oliver