craftcms / craft

Composer starter project for Craft CMS.
https://craftcms.com
BSD Zero Clause License
188 stars 91 forks source link

Don't fake php version in composer.json #27

Closed ostark closed 6 years ago

ostark commented 6 years ago

The "fake php version 7.0" prevents depencencies with other/higher requirements, e.g. php: "^7.1", even if the higher version is installed.

https://github.com/fortrabbit/craft-copy/blob/ad6c2204a01f05031df4f417ae78aeeb7403b09f/composer.json#L24-L26

Could not find package fortrabbit/craft-copy in any version matching your PHP version (7.0.0.0)

Instead of config/platfrom/php: "7.0" we should use require/php: "^7.0".

brandonkelly commented 6 years ago

We added it because a lot of people were getting errors due to running the same composer.lock in different environments with different PHP versions. For example they might run composer update locally where they're running PHP 7.2, and then deploy to a production server that's running PHP 7.0; which would result in syntax errors because composer.lock was set to use dependencies that take advantage of PHP 7.1 / 7.2 syntax. Forcing Composer to only install dependencies that are compatible with 7.0 helps avoid this issue.

ostark commented 6 years ago

You should reconsider this. EOL of PHP 7.0 is less than 6 months ahead. More dependencies require ^7.1 these days, Yii2.1 (soon) as well.

Btw, all of your hosting partners run PHP 7.1 or 7.2 by default.

brandonkelly commented 6 years ago

That line doesn’t prevent Craft from being run on PHP 7.1+. We’re going to keep it until a version of Craft comes out that requires a newer version of PHP. It’s easy enough to delete if you don’t want it (or just don’t include it in a fork of this repo).

ostark commented 6 years ago

Okay :100:

Maybe it is usefull for people to understand why you are doing this and how to solve it:

composer config platform --unset

davidhellmann commented 5 years ago

@ostark uh composer config platform --unset thanks!! :)

ostark commented 4 years ago

I noticed the tests in travis cover 7.1-7.3. Maybe, almost 2 years later it's time to reconsider this?

brandonkelly commented 4 years ago

We will change it when Craft’s PHP requirements change, which we expect will be for Craft 4, unless Yii forces our hand before then (I know they are at least considering it, due to Travis).