Skip to content

Conversation

@dkarlovi
Copy link
Contributor

@dkarlovi dkarlovi commented Jul 7, 2025

Closes #535

@jakzal
Copy link
Owner

jakzal commented Jul 7, 2025

Will this work, when devkit is downloaded by phpqa to update its own readme? 🤔

https://github.com/jakzal/phpqa/blob/2669c74fc430897f906674b07ac6b6fa32148054/Makefile#L45-L47

@dkarlovi
Copy link
Contributor Author

dkarlovi commented Jul 8, 2025

Will this work, when devkit is downloaded by phpqa to update its own readme? 🤔

https://github.com/jakzal/phpqa/blob/2669c74fc430897f906674b07ac6b6fa32148054/Makefile#L45-L47

Nice catch, it seems Box removes composer.json from the final PHAR file for some reason so we can't read it. 🤔

@jakzal
Copy link
Owner

jakzal commented Dec 16, 2025

@dkarlovi I cherry-picked your changes, but reverted reading from composer.json: #551

Now that the list is defined in a single place, we need to consider what to do next.

How about we pass the list of versions as command line arguments/options?

@jakzal
Copy link
Owner

jakzal commented Dec 16, 2025

Box supports generating metadata for the phar, but that would not work outside of phar 🤔

@dkarlovi
Copy link
Contributor Author

How about we pass the list of versions as command line arguments/options?

The tool itself should know (and does, since that's in composer.json) which versions it supports, that shouldn't be externalized IMO.

@dkarlovi
Copy link
Contributor Author

@jakzal what if we force Box to add composer.json as any other file? Then composer.json is always there and it should work in all use cases, and the PHAR knowing which versions are supported (it being built-in information) is correct IMO.

@jakzal
Copy link
Owner

jakzal commented Dec 16, 2025

@dkarlovi I tried that, but despite the following config added to box-devkit.json.dist, composer.json isn't added to the phar:

"files": [
    "composer.json"
]

@jakzal
Copy link
Owner

jakzal commented Dec 16, 2025

This works:

"exclude-composer-files": false,

@dkarlovi
Copy link
Contributor Author

So, since we can now assume composer.json is always present, shall we resume here with that tweak to Box config? Or did you have something else in mind?

@jakzal
Copy link
Owner

jakzal commented Dec 17, 2025

I'm a bit worried reliance on composer.json is a bit fragile and might break if someone changes the way version ranges are defined. It's an unexpected coupling. Version ranges in composer.json define what versions toolbox can be run on, not the versions we want to run it on (the later could be a smaller subset). Am I overthinking this?

@dkarlovi
Copy link
Contributor Author

dkarlovi commented Dec 17, 2025

Am I overthinking this?

NHF, but yes, I think so. TBH. 😄

Version ranges in composer.json define what versions toolbox can be run on, not the versions we want to run it on (the later could be a smaller subset)

Since the toolbox is meant to install tools which run on your PHP version, being able to install toolbox on PHP versions which it itself doesn't support any tools for is IMO a weird niche to worry about. From my POV, if you can install it, it supports your PHP version. If you cannot install it, it doesn't.

PHP versions in composer.json are exactly the versions we want here, even if technically toolbox could run on more versions, why would it? To tell you "Aschtually, this PHP Version is not supported"? Composer can do that by refusing to install.

@jakzal
Copy link
Owner

jakzal commented Dec 17, 2025

Ok, let's go with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Read the PHP versions supported by toolbox in devkit.php directly from composer.json

2 participants