We have integrated Sentry to our Laravel project and while deploying it, we were confronted with this:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for ocramius/package-versions 1.5.1 -> satisfiable by ocramius/package-versions[1.5.1].
- ocramius/package-versions 1.5.1 requires php ^7.3.0 -> your PHP version (7.1.32) does not satisfy that requirement.
Problem 2
- ocramius/package-versions 1.5.1 requires php ^7.3.0 -> your PHP version (7.1.32) does not satisfy that requirement.
- jean85/pretty-package-versions 1.2 requires ocramius/package-versions ^1.2.0 -> satisfiable by ocramius/package-versions[1.5.1].
- Installation request for jean85/pretty-package-versions 1.2 -> satisfiable by jean85/pretty-package-versions[1.2].
According to documentation, integration for Laravel 5 should work with PHP 7.1. We were able to get it working with patching composer.json, but I think this issue should be looked into.
Yep it is. However is it possible you installed your dependencies on a machine running PHP 7.3?
This could be caused by that dependency being updated too far because you used PHP 7.3+ to install the dependencies (and create the composer.lock file).
To prevent this and still be able to use a higher version of PHP locally you can put the following in your composer.json (i've only included the relevant parts so you'll need to merge this which your own config options in your composer.json):
{
"config": {
"platform": {
"php": "7.2.0" // Or whatever PHP version you are targeting
},
}
}
Composer is just doing what it can and uses the latest version for the platform it's running on, so thats why this goes wrong when you use a higher PHP version when installing the dependencies for the first time.
Thank you. I feel ashamed I did not catch this on my own, but I was not aware of config.platform.php composer.json setting and was expecting require.php to be enough.
@mx0r this bit me too, I also thought the require would be enough to make it understand it should at least support that version. However it does make a bit sense after thinking about it, at least there is an quite easy fix 馃槃
No reason to feel ashamed, we live and we learn 馃憤
Most helpful comment
Yep it is. However is it possible you installed your dependencies on a machine running PHP 7.3?
This could be caused by that dependency being updated too far because you used PHP
7.3+to install the dependencies (and create thecomposer.lockfile).To prevent this and still be able to use a higher version of PHP locally you can put the following in your
composer.json(i've only included the relevant parts so you'll need to merge this which your own config options in yourcomposer.json):Composer is just doing what it can and uses the latest version for the platform it's running on, so thats why this goes wrong when you use a higher PHP version when installing the dependencies for the first time.