-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infer default PHP version from composer.json #136
Comments
Hi ! I had many thoughts about that feature already... But I like the flexibility that the current situation offers. Let's say we implements your proposal, what would you suggest when the user wants to use the upper version instead of the lower one ? |
If users wants default, inferred from composer.json, they use |
Having the
or
Right? |
Behaviour for |
That's actually a super cool idea ! I didn't think about that!! Would you like to submit a PR ? |
Yeah I'll see how I am with time but it should be doable in foreseeable future :) |
Good, looking forward to it ! |
I updated the codebase these last days, implementing that feature should definitely be easy. Basically it boils down to parsing the PHP version in |
I found this regex to work pretty fine: https://regex101.com/r/NWCilZ/1 But since Nix is using |
I love the idea of inferring the version of PHP from After thinking about it, I'm not sure Reasoning
An Alternative IdeaWe could use the
Basic Usage for Alternative:Note: it's important to use the composer CLI commands to make the change, as it helps validate invalid values to rule them out. Set
|
I think we should tackle the issue in another way. For example, what I had in mind a couple of months ago was to create some kind of Composer plugin that would just return true or false based on the PHP version we (nix) provide. For example, we could build a simple command line tool that would be working as such:
or
Then composer would tell you if that PHP version is valid for that specific We could even think further, I don't think creating a Composer plugin is even required. We could generate a {
"require": {
"PHP": "^8.1"
}
} If it fails, that means the PHP version in use is not valid, and we must test with the next available one. WDYT of the idea? |
I love the idea of inferring default extensions to install from composer.json. I would like to have the same functionality for inferring default PHP version itself as well. At the moment, it's always defaulting to PHP 8.1, no matter what is in composer.json. I suggest to parse
require.php
fromcomposer.json
and detect minimum version from there. My initial attempt isbut this ought to be improved, because this doesn't handle values like
^7.4 || ^8.0
The text was updated successfully, but these errors were encountered: