How to upgrade Yii 1.x to Yii 2.0

Pawan Shukla picture Pawan Shukla · Oct 2, 2014 · Viewed 11k times · Source

How to upgrade Yii 1.x version to Yii 2.0 latest release version? I am using ubuntu OS , Process to updating my old Yii to new Yii release version 2.0?

Answer

Manquer picture Manquer · Oct 2, 2014

The Yii2 guide has excellent documentation in this regard see Upgrade from v1

I recently migrated couple of moderately complex applications from Yii 1.x to Yii 2.0. There are two ways to go about it , either you can run Yii 1.x and Yii 2 at the same time see using-yii-2-with-yii-1. Then migrate part by part, while it is possible it was quite bit of pain, like trying to rebuild the second floor while living on the third.

Alternatively you can rewrite the entire application bottom up with the exact same functionality, I found this to be much more efficient, significant code could be reused with only minor modifications, also that gave opportunity to tweak the design without changing functionality.

The important thing is to ensure the exposed API ( i.e. the frontend / UI / functionality) remains the same. It is always tempting to update functionality or change features during a rewrite, however if you stick to strictly reimplementing everything for Yii2 then consider changing your API, your migration will be smoother.