Your composer.json file tells the composer which version of the software to download. Which versions of PHP that the software supports are software dependent. If the package you are trying to download has stopped supporting PHP 5 in version 4, for example, you will need version 3, for example, "3. *" or "3.9" or whatever you require from your specific requirement.
"require": { "some/package": "3.*" }
https://getcomposer.org/doc/01-basic-usage.md#package-version-constraints
You can โrequireโ a specific version of PHP using the platform packages, but it doesnโt load anything, it just checks. Since you are developing at 7 and freed at 5, this is not what you want.
source share