Is there a difference when running Composer in different PHP versions?

I have a vagrant machine with real PHP version. I want my server to work, but locally I am using a newer version of PHP. Updating Composer locally just saves so much time rather than updating it in the VM over SSH.

So my question is, does this affect vendor files when composer install

or update

is it called from different PHP versions?

+3


source to share


1 answer


The PHP version used when updating dependencies affects the packages used. Packages can define a requirement for a specific PHP version.

The general requirement requires PHP 5.4 or 5.5 when the package uses features of the specified versions or PHP 5.3.3 or PHP 5.3.27 because the package needs some fixes.

The composer will complain about the inability to execute composer install

if the PHP version used when executing that command fails to meet all the PHP version requirements mentioned in the lock file.



Running composer update

with an older version of PHP than composer install

will probably work in most cases. However, using the same PHP version should be the recommended setting.

Also: validating the requirements also requires the use of the same required extensions in all PHP versions.

Note that there is some need for Composer to assume that a given PHP version or extension is present on the target platform, even if the PHP command line running the Composer command does not execute them, but this feature has not yet been implemented. Thus, there is no way to override the local PHP version with the one present in the target environment.

+4


source







All Articles