Search code examples
yiiyii2yii-extensionsyii2-advanced-appyii2-basic-app

How can I upgrade Yii 1.x to Yii 2.0?


How can I upgrade the Yii 1.x version to the Yii 2.0 latest release version?

I am using an Ubuntu OS. What is the process to updating my old Yii to the new Yii release version 2.0?


Solution

  • The Yii2 guide has excellent documentation in this regard. See Upgrade from v1.

    I recently migrated a 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 an 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.