-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Require PHP 7.1 for Yii 2.1 #11397
Comments
php 5.5 for minimal version required for yii2.1 |
php 5.6 for minimal version required for yii2.1 |
php 7.0 for minimal version required for yii2.1 |
Its depend on when 2.1 stable version released. I am pessimistic it can be done in early next year :D. |
Ubuntu LTS this summer is going to ship PHP 7 by default. |
@samdark actually it just got released today http://releases.ubuntu.com/16.04/ |
Oh! Great. |
I remember when we discussed the 2.0 minimum and at that time we were "cautious" and stick with 5.4 that became obsolete before YII2 was "spread out". |
thats another very valid point @kavitama. Yii2 took a while for people to migrate from Yii1 or other frameworks. We need to take into account the time it will take to get it developed + the time it will take to "spread out" |
TBH since Yii2 is already compatible with PHP7 it is reasonable to say that most code written for Yii2 will only have some oddities (like the use of I think this thread is vague for one. As I said Yii2 is PHP7 compat, so what would change by making PHP7 the min version? The only real thing is if Yii2 starts using PHP7 specific stuff such as autoloading of functions in namespaces. |
#7936 should also be considered to not having to drop v2.1 and building a 2.2 when PHP 7.1 or 7.2 is released. |
2.1 isn't going to be such a huge update that it's impossible to update apps with some code changes. We aren't going to do 1.1 → 2.0 again. It will be 2.0 → 2.1 → 2.2 → ... → 3.0 i.e. incremental breakages. |
The minimum required version has to be determined by technical requirements. If we find that using features that are in a higher version, we can bump version requirement. If we do not use any of the features, the min version will stay. That means, if we bump to 5.5 or 5.6, what are the features we are going to use?
I am for 5.6 because it adds some cool things that can improve many parts of the framework, such as But if we bump to php7 that would mean a lot of framework concepts should be thought through from ground up considering the newly available languages features. Imo that is out of scope for a 2.1 but rather something for a 3.0. |
7.0 is for security features only but it's from "nice to have" category since we're already covered that via other means. |
PHP7 has a lot of feature we can use.
use common\models\post\{Post,Category,Comment};
PostController extends Controller
{
public function actionView(int $id): string
{
$model = $this->findModel($id);
// etc
}
public function findModel(int $id): Post
{
if (null === ($post = Post::findOne($id))) {
return $post;
} else {
// exception
}
}
} This code is not only easier to read for humans, its also much easier to read for IDE's https://blog.jetbrains.com/phpstorm/2015/11/phpstorm-10-is-released-php-7-support-interactive-debug-console-repl-dataflow-analysis-phpunit-5-support-and-more/ |
Nope since they do not support nulls. |
public function getOrders(): ActiveQuery
{
return $this->hasMany(Order::class, ['customer_id' => 'id']);
} Doesn't need a |
Yes. I'm talking about |
yup those methods can't take the advantage for return typehints, but those are exceptional cases |
@Faryshta most of what you say does not require the framework itself to require php7. The framework can be PHP7 aware but still be compatible with php5.6. That means if you want to use php7 typehints in your application code, you are free to do that. |
There will always be people who try to slow down the development. I believe our way to be ahead. That's why I'd like to at least php7.0. |
IMO we should not bump requirements to PHP 7 unless there's really good reason to do so. The only acceptable reason I could think of is a boost in performance. I doubt that there's any PHP7-only feature that would have such a great effect - note I'm only talking about framework code here. So my vote goes for 5.6 to not lock out too many developers. Yii is a framework and as such should put as few constraints on the developer as possible. |
PHP 7 is so fast and usable! See http://www.slideshare.net/laruence/php7-for-its-best-performance |
Zend 3 is a massive improvement even without using PHP7 features. I mean On 29 April 2016 at 09:29, duruitang notifications@github.com wrote:
|
you can have php7 perfomance without forcing other to use php7, so that is not an argument in the discussion here. of course we support php7, the question is only if we should require it. |
@cebe another idea can be to have two branches. 2.1 and 2.7 for example with 2.7 requiring php7 and 2.1 php5.6 and then let composer figure out which one install depending on the server Like its done here https://paragonie.com/blog/2016/04/go-php-7-our-commitment-maintaining-our-open-source-projects |
that sounds complicated and confusing. |
@yacine-harbi ok, but IMHO new frameworks (or new version of frameworks) should use actual technology - not stay behind because some admins can't update PHP version. |
@yacine-harbi we aren't going to raise requirements for 2.0.x. |
@yacine-harbi pretty sure 7.1 will soon be available in the debian backports. |
For now we have https://deb.sury.org/ |
as of right now, 7.x is the only answer here even worth considering. From the security updates, performance boosts alone it's worth the upgrade. Then you bring in options like null coalescence, scalar type hints, generator delegation, throwables just to name a few -- and things that I use extensively in our yii2 application. Any choice but 7.x is a crime against humanity. php5.6 is past it's acceptable EOL limit, and this is the reason that other frameworks have already made the shift. |
btw: https://twitter.com/cebe_cc/status/866398230665453568
|
This might help to decide: https://gophp71.org/ |
It's already decided but thanks for the link. Added Yii there: deprecated-packages/gophp71.org#3 |
@samdark Glad to hear that, thanks for the PR! |
The commit 0117459 requires 7.1 - unless reverted, the decision is made 😶 |
php 7.1 for minimal version required for yii2.1 |
I would like to suggest that we up this to "the latest version" at the time 2.1 is released. Since it is a BC break to up the requirements, I'd rather do it right instead of getting stuck with a version that has limited support by the time we release 2.1... |
Hm, 7.1 will be supported to 1 Dec 2019, and 7.2 has no (many) cool features http://php.net/releases/7_2_0.php |
Isn't that just security support? |
Yes and no: http://php.net/supported-versions.php |
Currently it's coded with 7.1 in mind. We can switch to 7.2 if it will give us any advantages. |
When we can wait Yii 2.1? |
…sageFormatter::parse()` method were removed resulting in performance boost. See UPGRADE for compatibility notes
Added ternary_to_null_coalescing to php-cs-fixer config Related to #11397
…sageFormatter::parse()` method were removed resulting in performance boost. See UPGRADE for compatibility notes
* 2.1: Fixes yiisoft#11397: `yii\i18n\MessageFormatter` polyfills and `yii\i18n\MessageFormatter::parse()` method were removed resulting in performance boost. See UPGRADE for compatibility notes Update PageCache.php Fixing tests after meging with master Use null coalesce operator where possible
Decision
Update to PHP 7.1.
TODO
Original issue
Currently only php 5.6, 7 and 7.1 are supported
http://php.net/supported-versions.php
php 5.5 is in security-only support and will reach end of life very soon, while php5.6 will enter security-only support next year. Probably yii 2.1 will take around a year to develop, by that time the entire php5 branch will be obsolete.
Today ubunt 16.04 will be released which includes php7 as the default version and its an LTS so we can expect a lot of server providers to switch to it an offer php7 effortlessly during the next months.
Requiring php7 for yii2.1 can be very useful
use
groupsI propose to make a poll using emoji's. I will post 3 options bellow and any reaction to them (:+1: :-1: etc) count as a vote for that option. That way someone can vote for more than one option.
The text was updated successfully, but these errors were encountered: