2

Is there a way to do a Composer build with a php version different from what is installed locally?

My use case is that I have a development container using php56 which lives on a host that has php54. The two environments have a shared folder where the project files live, and I do my builds from an IDE living on the host machine (which uses 5.4).

In a perfect world, I would just upgrade my host to 5.6, but I work on some projects with the lower version.

3
  • So you want to do a composer install with php 5.6 on a php 5.4 host? Commented Sep 18, 2015 at 12:12
  • @Mitchell Olsthoorn: Yessir. Commented Sep 18, 2015 at 12:16
  • For what it's worth - I installed php56 temporarily to work around the issue, but it would be nice to be able to do builds targeting a specific php version. Commented Sep 18, 2015 at 12:19

2 Answers 2

2

I don't think you can change that because composer uses the php version that composer is run with, so there are only a few options

  • Install the required php version as extra installation (as you already did)
  • Change the source of composer where the version is taken from the php environment (not really a good idea)
  • Maybe installing the dependencies from your development box, because you said that you had a shared folder between the systems

The last option is the most promising in my opinion because linux has very nice support for hosting multiple versions of php with phpenv

Sorry I couldn't give you a real solution

0

I've been accomplishing this using Docker:

docker run -v $(pwd):/app composer/composer update

Not the answer you're looking for? Browse other questions tagged or ask your own question.