I know the current plan is for Yii 2.2 to require PHP 7, but i’m wondering if anyone has considered having Yii 2.1 require it as well.
Here’s why I think it would be a good idea:
Ubuntu LTS has been shipping with PHP 7 by default since 16.04, which was released in April 2016, so it’s pretty widely available now.
PHP 5.6 active support ended on December 31.
Many Yii projects won’t have any choice but to run PHP 7, if we want to keep up-to-date with other dependencies. (Twig 2 came on Jan 5 and requires it, PHPUnit is coming out on Feb 3 and requires it, etc.)
The sooner Yii can be updated to take advantage of new PHP features like scalar type declarations, the better!
As for Craft CMS, we’re already seeing about 34% of new installs running PHP 7, and we’re still only requiring 5.3. Our upcoming 3.0 release built on Yii 2 will require PHP 7, regardless of what PHP version Yii 2.1 ends up requiring.
We aren’t really using any of PHP 7 features in the framework itself and it seems there aren’t many which are beneficial for us so there’s no point in strictly requiring PHP 7 except maybe marketing…
Scalar type hints won’t give much for the framework itself. Return type declarations as well. Additionally return type declarations are pretty much unusable before 7.1 because nulls aren’t counted as valid return value so you have to introduce null-objects which is not good for all cases.
I think most than anything else, you as the framework maintainers should push people towards using PHP >= 7, otherwise we will stay stuck with php 5.x for a very long time and this really is a bad thing if coming from people that have something to say in the PHP world.
I do not think it is a bad thing to be compatible with a lower version of PHP if it runs fine on 7. The minimum requirement is a technical thing, not a political one, so we would only bump the requirement if Yii technically requires PHP 7 code.
To do this we should rethink a lot of the frameworks concepts based on PHP 7 features to build something that makes sense and not something that has PHP 7 features just for the sake of it.
I will start working actively on Yii 2.1 in April this year, I sadly have no time for it before that. If we find that by using PHP 7 features we can improve the implementation a lot and the whole thing makes sense, we will of course consider bumping the requirement. That is something we’ll see when working on the implementations, not something to decide on upfront.
Personally, I couldn’t care less if some people think that using PHP 5.x is great, because it obviously isn’t
The performance gain alone is totally worth it - and because of the performance, most - if not all - hosting companies have made PHP 7 available for their customers.
However, it is Bad Practice to arbitrarily require a version of PHP that Yii does not actually require. Yii shouldn’t engage in politics.