Yii2 and PHP 7

Hello Friends,

I know it’s too early to discuss but I think better this community start discussing on the near future.

I have already done many projects with Yii 1.1.x and a few with Yii 2 and when I look for my future projects I still find Yii 2 as better option. But still when I have PHP 7 with major performance overhauls and changes I definitely look for my applications to be PHP 7 compatible so that we all can take performance boosts expected.

I know YII Devs must have been thinking on this but I wish if you could share your future insights on the topic would be a great moral booster for YII community.



We’re looking into it. There is a problem with Object but overall it should work so when PHP 7 is released Yii will become compatible quite fast.

Was looking to hear this :D

I just started a project on Yii2 and i would really appreciate if you could give some more details. Would we have to do any changes to our codes. I never modify the codes in yii. i always extend my classes if there are anything to change and use the extended class. In yii1 i started doing this because whenever i wanted to regenerate my models it would be a pain to merge the changes. and in yii2 i think it happened to me that i changed the BaseYii.php to add a new environment just for some testing to see how it works and when i updated it via composer i think the changes were gone.

So could you provide some details to what should we expect when php7 is out so we are able to get prepared for it :P

also if i need to add a new

defined('YII_ENV_STAGING') or define('YII_ENV_STAGING', YII_ENV === 'staging');

so the changes remain if i update yii.


Most probably no major changes will be required. Probably renaming extends Object to extends YiiObject or something like that.

You can add as many constants as you’d like, these won’t be affected.

Thank you Sir, delighted to hear it.

yes we can use php7 end of this year. i glad to hear that i can use yii2 without many modifications. thanks yii team

Will Yii 1.x be compatible with PHP 7 or are there any plans to make it compatible? Thanks!

Have you tried it with PHP7? What are the issues?

Thanks for you answer. I have not tried it with the current version of PHP 7. Waiting for stable/release to be made in mid October.

I throw back the question: have you or anyone tried it with PHP 7 in its current state? If yes, what were the results? Thanks again

We’ve tried Yii 2.0 and it’s compatible. Haven’t really tried 1.1.

It’s great to hear that. In 21 Aug 2015, PHP 7 go to RC version.

Most probably no major changes will be required. Probably renaming extends Object to extends YiiObject or something like that.

You can add as many constants as you’d like, these won’t be affected.

Renaming Object to YiiObject isn’t required.

How is everyone doing? :) Is Yii ready for php7?

We’re doing fine. Yii 2.0 is ready for PHP 7. There are minor edge cases fixed each next version but so far, none of these were too bad. I have PHP 7 + Yii 2.0 in production.

Good to know! We’re planning to slowly migrate to PHP7 soon too (for theprintful.com)!

Great. How’s the project doing btw. As far as I remember, you’re one of the earliest adopters of 2.0, right?

Hi All, Happy to join thus forum from Bangalore, India. during April this year we were looking into moving all our website developments for clients in better framework rather using basic other framework. After much debate between laravel and yii we took our chances with Yii and mid of may 2016 we started learning more about Yii and started our development on Yii 2 with PHP 7. We had a wonderful experience in production though getting used to Yii 2 initially took some time but with continues study. We just loved Yii 2. Research we have completly finished our re development of CRM website today with 11 xml api integration of world’s major travel website such as Expedia, Booking.com, Hotel beds, GTA, Makemytrip, Goibibo, Cleartrip, Travel guru, Jovago, Hotel travel and more api integrations in progress.Today we hv configured or google cloud instance with PHP 7.0.10, PHP extentions and uploaded all our production to test for 3 days on live. Tomorrow we shall finish installing other Yii 2 specific required extentions, then test our production live with API providers and hopefully we will change dns from existing cloud and will be live for public by thus weekend.

Nice! Thanks for sharing.