Open ajiho opened 2 months ago
Considering your project has a "php": ">=7.2"
requirement, upgrading to 8.2 shouldn't break anything since it's within it's constraints. Also, any damage done to the installed packages can be undone by removing the vendor folder and running composer install
again.
That being said, what I would suggest from a production standpoint is:
What I used to do in the past is have multiple php versions locally:
The one you use to run composer update/install
on the project which is 7.2 in your case and run it with /usr/bin/php72 $(which composer) update
or whichever dir you installed the php version required for composer.
And then the other php version (8.2) php-scoper /usr/bin/php82 php-scoper.phar add-prefix ...
.
This way both project/composer and php-scoper run on the required php versions.
The other way, and the way I am doing it now is locking the platform's php version by editing my project's composer.json
and adding the following section:
{
....
"config": {
"platform": {
"php": "7.2.34"
}
},
}
This way, I can run a single php version (8.2) but composer will always require packages versions compatible with the specified php version (7.2 in this case), because he thinks I am using the specified version.
My composer library has the following restrictions on PHP
If my local PHP version is PHP7.2, then I can only install
php-scoper
version for PHP7 through Composer e.gphp-scoper v0.13.9
If I upgrade my local PHP version to 8.2. x and then install the latest version of
php-scoper
e.gphp-scoper v0.18.5
. Used to obtain the latest options and feature support forphp-scoper
and add prefixes to the code, will it cause damage to my composer library? Is this usage method correct?