20

Magento will continue to mostly use the original Zend Framework (version 1) for Magento 2 (source: Magento 2 and Zend Framework 2 )

Seeing as how Magento 2 will not be backwards compatible with Magento 1 anyway, why are they not upgrading to Zend Framework 2?

I'm hoping for an authoritative, technical answer.

  • this question is 99% similar to magento.stackexchange.com/questions/33259/…. but cant set it as duplicate since the previous questioner didn't accepted @Marius answer. However I am eager to know its answer. Let us wait for an official answer for that "WHY" :-) – Rajeev K Tomy Sep 25 '14 at 7:05
  • 4
    Only a core dev can answer this accurately. Let's summon @AntonKril. – Marius Sep 25 '14 at 7:06
  • @Marius : yes this question is a basic doubt that will come to our mind whenever we starts to learn magento 2 (especially who has familiar with magento 1.*). This should not be kept in secret. Rather should be disclosed. Let us hope for an official to give an answer for this question – Rajeev K Tomy Sep 25 '14 at 7:09
31

Just to repeat the important parts above, Magento 2 applications should use the official Magento 2 APIs, not Zend directly. Thus developers should not care which we build upon.

For inquiring minds, Magento 2 uses bits out of different frameworks. We use the database access out of Zend 1. We investigated moving to Doctrine, but it was too much work for the Magento 2.0.0 release. We may however do it in 2.1, 2.2, 3.0, or... (no commitment yet). When we do get to it, we may also change our mind whether to use ZF1, ZF2, Doctrine etc based on new information available. Magento 2 might also have a YML file in it (meaning we use part of Symfony). A part of the installer used some of ZF2 (should we develop a new app on ZF1?), but this may change. We also saw a tiny part of Angular that possibly looked interesting for MV* in JavaScript.

But as soon as you are looking what is under the Magento framework, you are probably doing the wrong thing. Your application code should not care. You should be using the "official" APIs provided by Magento framework so we can change the internals without affecting existing customer sites or extensions. By "official", we are going to document which APIs are "supported" APIs (not done very well yet) - to make upgrades more reliable, we are going to keep these APIs as stable as possible, but make changes to the underlying code base to improve performance etc.

Note: I don't look in this area very often - Magento 2 questions are watched on the GitHub issue tracker. We are trying to keep them all there at present.

  • 1
    Is it then wrong to use Zend classes in our code? I noticed that Magento calls some Zend static functions in the template files i.e. <?php echo \Zend_Json::encode($block->getCheckoutConfig()); ?>. – Zvonimir Burić Oct 24 '15 at 9:41
  • 1
    Yes, @ZvonimirBurić, you should use \Magento\Framework\Json\DecoderInterface instead. Or json_encode/json_decode directly. – nevvermind Jul 4 '16 at 11:44
  • what about validators? seems there aren't Magento equivalent of Zend_Validation – Antonio Pedicini Nov 3 '17 at 10:49
10

The question was asked many times. It all boils down to return on investment. It is huge effort to migrate, the value is not that high and Magento, because it is including ZF1 as a library in the distribution, just takes responsibility for this library, including patches for issues etc.

  • 2
    Thanks for the answer Piotr. Do you know if ZF1 is still supported by Zend? I found a (possibly outdated) FAQ (here: framework.zend.com/about/faq) that states: "We currently plan to fully support Zend Framework 1 until at least early 2014, including maintenance and security updates." – user4433 Sep 25 '14 at 7:26
  • 3
    @Marius : magento 2 going to rule for the next 2,3 decades (hopefully). In that case, as Tom said, if ZF1's support is expired, then what would you think about the future of Magento 2. Keeping an out-dated basis is good enough ? who knows ! – Rajeev K Tomy Sep 25 '14 at 7:38
  • 5
    Based on their handling of PHP, I'm guessing Magento has a policy of being extremely conservative with their releases. They require the oldest stable release of PHP that is still getting security updates. They required 5.3 until PHP finally announced end-of-life. If I had to guess, I might think that their approach to ZF is the same: to use the oldest and most stable version that still has support. The question to me, as programmer_rkt comments, is will Magento switch to ZF2 when ZF 1 reaches end-of-life even in a 2.x release or will they maintain ZF1 themselves w/o Zend and the ZF1 community. – user4433 Sep 25 '14 at 8:07
  • 3
    This is the correct answer. :-) – benmarks Sep 25 '14 at 19:13
  • 2
    I don't know that we'll reconsider, I don't know that we won't. If the effect of not being on ZF2 were strong that might influence things, but I doubt that will be the case. Keep in mind that I am not part of the product team, so this is just my opinion. – benmarks Sep 26 '14 at 2:31
2

For the same reason they used Prototype.js instead jQuery for Magento 1.

It seems ZF1 is about twice faster then ZF2. Check here

The issue is that ZF1 is not supported anymore (as far as I know) as of this year. I personally would go with ZF2. I'm sure they will optimize it some time soon.

  • 1
    I have read that jquery was a baby when magento 1 released and prototype.js was the well established javascript tool out there. For a big fish like magento, relying on a non-established tool like jquery (at that time) is out of box – Rajeev K Tomy Sep 25 '14 at 7:25
  • Thanks for the answer. Can you please elaborate a little? – user4433 Sep 25 '14 at 7:27
  • 1
    Well, it seems ZF1 is about twice faster then ZF2. Check here: developerknowhow.com/zf1-vs-zf2 The issue is that ZF1 is not supported anymore (as far as I know) as of this year. I personally would go with ZF2. I'm sure they will optimize it some time soon. – Razvan Sep 25 '14 at 7:54
  • I'm not sure if Magento picked Zend Framework due to its speed of execution. It's not exactly known for being fast. – user4433 Sep 25 '14 at 8:18
  • I did some research and found that the latest version of ZF1 was released 8 days ago. framework.zend.com/downloads/archives It seems like it's still very much supported. – user4433 Sep 26 '14 at 3:17
1

Magento 2 is using Zend Framework 1 as well as Zend Framework 2 also. Please refer following answer by Raphael Zend components in Magento 2

Zend Framework 1 End of Life is 28 September 2016. See the official statement release Zend Framework 1 End-of-Life Announcement

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy