How can I migrate Zend Framework 1 to 3

Dheeraj picture Dheeraj · Oct 22, 2016 · Viewed 8.3k times · Source

Has anyone please describe how much architecture changed by Zend from Ver 1 to 3. Recently zend released ZF3 but no information provide how to migrate from zf1 to zf3. I have an application was developed in zf1, now looking for upgrade it to using PHP 7 power with ZF3. Should i need to rewrite entire code or how much effort need to move to latest version.

Also, ZF3 claimed its 4x faster under PHP7. In reality it is PHP7 itself which is faster, not ZF3. I am not sure how much they improved as comparing to Laravel framework which is one of top framework past few years.

If anyone used the ZF3 please share their experiences.

Answer

webjawns.com picture webjawns.com · Oct 24, 2016

If you're dealing with a large application, there will not be a quick and painless way to migrate to ZF3. From routing to services, both the practical and theoretical framework that sits beneath Zend Framework 2/3 is quite contrary to that of the first iteration.

When ZF2 was first released, I completed a ZF1 to ZF2 migration (as well as ZF2 to ZF3) on a very large project. We ended up using an incremental approach, requiring minor deviations from the core ZF1 library (i.e. we edited several Zend classes), which worked very well for us. Since ZF1 hit EOL in September, meaning there will no longer be any bug fixes or updates of any kind, this shouldn't pose a significant problem for you.

In the post I listed below, you'll find a description of the steps that allowed us to complete this migration, as well as a link to some of the code that aims to partially bridge ZF1/ZF2. Because the change from ZF2 and ZF3 did not create too many backwards compatibility issues, the steps I detailed in that post should still be (mostly) applicable for the migration from ZF1 to ZF3.

Step by step migration from Zend Framework 1 to 2

Here are two more links you may find helpful. The first link is the ZF1-to-ZF2 migration guide supplied by Zend. The second link is the general documentation for Zend Framework. If a component has been updated to version 3.0 (e.g. zend-mvc, zend-servicemanager, etc.), it should contain a migration guide that tells you what has changed between ZF2/3.