Issue
I have a Vagrant machine with the actual PHP version I want my server to run on, but locally I use a newer version of PHP. Updating Composer locally just saves so much time as opposed to updating it on the virtual machine via SSH.
So my question is: Does it affect the vendor files when composer install
or update
is called from different versions of PHP?
Solution
The PHP version used when updating the dependencies affects the packages being used. Packages can define a requirement on a certain PHP version.
A common requirement found is requiring PHP 5.4 or 5.5 when a package is using the features of said versions, or PHP 5.3.3 or PHP 5.3.27 because the package needs certain bugfixes.
Composer will complain about not being able to execute composer install
if the PHP version used when running this command is not able to fulfill all PHP version requirements that are mentioned in the lock file.
Running composer update
with an older PHP version than composer install
probably will work in most cases. Using the same PHP version should be the recommended setting, though.
Also: Using the same required extensions in all PHP versions also is needed for requirements checking.
Note that there is some demand for Composer to assume a given PHP version or extension is present on the target platform even if the command line PHP running the Composer command does not fulfill them, but this feature is not implemented yet. So there is no way to override the local PHP version with the one present on the target environment.
Answered By - Sven
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.