010101 Is this new since 1.0 or 1.2 that Flarum forces a certain php version
Flarum has always had specific PHP requirements. It is slowly going up now because PHP is actively being developed on and abandoning older versions (see https://www.php.net/supported-versions.php); 7.4 only gets security patches now. This means older versions cause you to be vulnerable to attacks.
010101 forces a certain php version when using composer
Composer is a dependency manager. It checks what you need and whether your platform/server supports it. It warns you - ahead of trying to run your software - whether your server isn't compatible. You can use the --ignore-platform-reqs
to force installation regardlessly.
010101 But shared hosts sometimes use a lower version of PHP with their SSH / command line access.
Them not allowing specific versions with SSH/cli is a bad thing. Especially with the speed new PHP versions come out. Unless these hosting providers run some kind of custom platform, not being able to set your PHP version for your website and SSH should be a thing of the past. I've worked at a hosting company over 5 years ago and back then this feature was already wide spread!
010101 I don’t think there should be such strict constraints at the composer install level.
Actually composer does a perfect job. It downloads packages compatible with your php version and operating system. It glues together the foundation that is Laravel, Symfony and many other packages for use on your specific hosting plan; without any fuss. If you'd forsake that, the risk of running into errors (even silent ones) are pretty high, especially when the PHP version difference is a major one (5.x 7.x 8.x).
010101 And using php8 composer also will not work with all hosts.
It doesn't. That's why you can ask your host how to install using composer for different php versions. Or use the flag given above at your own risk.
010101 It would be better to not rely on composer as much, let the install happen,
You cannot install without composer. It understands dependencies and dependencies of dependencies for packages. For instance when installing Flarum it will load flarum/core
, check which version of core is compatible with your OS and PHP version. It will download Laravel and Symfony packages that core includes and runs exactly the same checks. Laravel and Symfony also have dependencies, like Flysystem. Well.. you see what is happening? How exactly do you propose these downloads happen without using composer?
010101 Because with situations like this person’s and mine, the install then would be successful and everything would work as long as the php version in the directory where core is installed is high enough.
Your hosting provider should offer a way to configure PHP versions on the webserver level and on the SSH level. This was possible years ago and is widely available in software like CloudLinux, DirectAdmin, CPanel and many more.
You cannot and should not criticize maintainers for providing you with secure software.