Which Framework Would You Put Under Magento 2?

confusedThe current plan of record is to keep Magento 2 on Zend Framework 1. Magento provides much of its own framework that developers are expected to use. It does however leverage functionality currently from Zend Framework 1. The original plan of sticking with Zend Framework 1 was based on the benefits of moving to Zend Framework 2 being minor with the port taking significant effort. (It was also related to the current plan of record to defer reworking database access until post 2.0.) The Magento team can if required support Zend Framework 1 issues that come up that are important for Magento (for example if Zend decide to stop releasing patches).

While the current plan remains unchanged, with the developer beta period coming up it feels like a good time to review this decision and gauge current public opinion. This would be used as one input to internal discussions. But to set expectations, there is NO plan currently to change the underlying framework. Shall I repeat that? There is NO plan currently to change the underlying framework.

What Has Changed?

There are a few things that appear to have changed since the start of the Magento 2 project.

  • There are questions whether Zend Framework 1 will continue to work on newer releases of PHP. Looking at patch 1.12.7 it mentioned including a change to make it compatible with PHP 5.6, so maybe it is not a concern, but will it work with PHP 7?
  • It looks like Zend Framework 2 is not getting as much investment as Symfony 2. (This may simply be because Symfony is more popular so getting more external contributions – there is no implied comment on Zend here.)
  • Zend Framework 2 and Symfony 2 both are reported as slower than Zend Framework 1 in this comparison of 20 PHP frameworks. (In fact, they are the two slowest!)

Your Voice

Time to have your say! Which framework do you personally think would be best?

  • Staying on Zend Framework 1 is the least short term effort (and the current plan).
  • Upgrading to Zend Framework 2 could be considerably less effort than moving to Symfony. For example, a Symfony port may be undoable by the current GA date with Zend Framework 2 being more feasible (but a squeeze).
  • Symfony seems to have the most mind-share for PHP frameworks today.
  • Moving to Symfony would likely trigger a much more radical change around database access than moving to Zend Framework 2 (which may be good, but take longer).
  • Maybe there is another framework that is a better fit with Magento. One that provides what Magento does not support natively, but does not provide what Magento already has. (Slim? AuraPHP? Phalcon? etc)
  • Should instead Magento provide a façade to hide the underlying framework? That may allow it to be swapped with no impact on extension developers, but also means developers could not use extra functionality provided by the framework if they wished to be portable across frameworks.

So please vote! Leave a comment to add more color. Opinions welcome! But I do want to repeat that this is information gathering and absolutely no commitment to follow any feedback provided. This is one of many inputs into internal discussions, with the most likely result of staying the current course.


  1. I cannot believe Magento is still considering sticking with PHP. Where is the love for JavaScript? Node.js is mature. Its event loop is flexible and brings enough chance for ecommerce to be more rapid and agile than ever before. Just because it hasn’t been done on the scale Magento operates doesn’t mean it cannot be done.

    Think outside the boundaries of “Zend” or “Symfony” changeset. They are needless limitations. JavaScript is the future on front- and back-end. Middleware and business logic. I can’t believe eBay, an innovative and ever developing company is still developing in a language which cannot get its argument order consistent.

    Get with the times before it is too late.

    1. Thanks for the comment. Changing language with a large established developer base would be a huge change. So we are lifting the game introducing dependency inject, service contracts, etc. Better REST access also should open up options around integration with different front end technologies for thise who want to experiment.

    2. Wow that’s a great idea, Fred. You’re totally right – Magento needs to switch to Node.js ASAP. Because then their argument order will be correct and they’ll also finally be web scale.

      Do you think they should migrate off of MySQL as well? Maybe move to Mongo?

      1. The database, and this is out of experience, is often the bottleneck but in Magento is not necessarily the database but rather the database architecture. Magento wants to be “just in case” for everything and the result is an over-engineered EAV model way too complex for its real-life applications.

        The entire database schematics can indeed be reworked so they fit in a document-based-storage like Mongo. I am okay with that. What I am not okay with is people pretend that MySQL is the problem. It is like saying the car is too heavy so lets make it faster so it can brake faster. It makes no sense. Almost if you are making fun of the subject of acceleration.

        Or Magento’s use of MySQL. I don’t know. There are better database engines out there but to reconsider the entire database abstraction layer two weeks before version 2 goes into beta? I wouldn’t risk it.

  2. Interesting question. Personally I don’t know very much about ZF2 or Symfony.

    I can understand why you would stay on ZF1 even though it’s by now it’s pretty old if there aren’t significant benefits to moving to ZF2. I’m curious – has anyone written up some of the key differences between ZF1 and ZF2 in the context of what would be leveraged by Magento 2?

    I think that if we’re talking about moving to an entirely different framework (Symfony), Laravel might be worth looking at. I don’t have a ton of first hand experience with either, but I seem to hear people rave about Laravel quite a bit these days.

    A façade to hide the underlying framework sounds like it could be a happy medium, especially if it doesn’t take a ton of time compared to the alternatives.

    I think I’ll vote for ZF1 for now b/c I’m not real clear on what benefits the other alternatives would offer, and I can imagine that either other features or having the product done sooner would be more beneficial.

  3. why guy’s you didn’t see the yii2 new thing’s just try to test it it’s awesome …🙂


  4. As already noted in Twitter it’s even new to me that Magento is now considering to stick at ZF1. My latest update was to actually build their own Magento framework, which would have been a lot of work and risk in doing mistakes others have already done before, and successfully solved btw. I don’t care so much if it’s ZF2, Symfony 2 or any other framework build on some newer architecture. Devs will get into that very fast.
    But as this is a major upgrade Magento will anyway break b/c a lot and should take that as a chance to also upgrade the lower level of the application. Maybe performance is a bit slower in ZF2 than in ZF1, but that also comes with a lot of benefits in the architecture. Besides that how long will ZF1 still be supported? Will that last until Magento 3 is ready?
    Anyway taking an existing open source framework as the base is a good choice as Magento should concentrate on their core business!

    1. Btw I think one very important fact is missing in this discussion, which is also the reason why I would choose Symfony 2. No technical advantage, performance or fancy architecture. It’s documentation and community which become an ecosystem.

      One of the biggest reasons for the success of Magento is imho its very active community, where Magento and Varien have done a great job before. The same thing what has thriven Symfony getting to that success.

      So building on Symfony means you get instantly a huge amount of documentation for the core and a very active ecosystem. But besides that also an army of developers waiting in line to touch their fingers on a major e-commerce system based on their beloved framework.

    2. I am not sure what was said, but I have never heard of any plan NOT based on ZF1. Magento has a lot of its own framework, but we build on top of an existing framework. The goal is to add functionality we think appropriate for Magento not provided by the framework we are on.

  5. I dont think a late framework shift would be a wise move as ZF1 specifics will have bled in to magento itself in (likely) non trivial ways.

    For that reason a facade would also be a terrible idea. In addition to ZF1 being difficult to extricate you will likely introduce additional abstraction leaks which will mean you have this intermediate facade that is just adding complexity while providing nothing.

    Finally if magento 2 is anywhere near as heavy as magento 1 then the framework overhead from a performance perspective will be a small fraction of request processing time.

    The right time for this question has long passed.😦

    1. Thanks for the feedback. Minor point on the first note about zf1 bleeding in, to be clear Magento 2 is refactored Magento 1 code so zf1 was central from the beginning. The question was always around the effort to remove it.

  6. Another reason it’s better to move to Symfony 2 is because Magento2 developers will have a faster learning curve when they want to develop Symfony 2 and Drupal 8 websites.

    The same applies for Symfony 2 and Drupal 8 developers.

  7. Both frameworks are very similar and very different in the same time, concerning Magento I don’t think that using one of them would slow down the app, just because Magento can potentially use this frameworks and it will not be a Symfony2 or ZF2 app.

    Btw, Fabien Potencier in a old blog post “Why Symfony?” unintentionally started a war between the two factions.
    Imho the better answer to that post that for me, is the better one in this context even. It has been given by Marco Pivetta and I’ll quote here an excerpt:

    …Since composer entered into the PHP scene, thinking that “I won’t use framework X because I use framework Y” is not something applicable.

    You just require `symfony/console` and `zend/event-manager` and `propel/propel` and `doctrine/mongodb-odm` all together… See? It works!

    So let’s think about building things WITH symfony, not “only with” symphony….

    I couldn’t express better my opinion about that, for me this should be the road.

  8. Fully agree with Valerio. As soon as Magento supports composer, I think it doesn’t matter which framework to use, the team can even use both, for components that are missing in another one.
    But keeping ZF1 is a terrible idea, it is obsolete. ZF1 could be faster than ZF2 with initial settings, but you can also turn on a lot of optimisations, including classmaps, etc in ZF2.

  9. I met with Yoav and Dima back in late 2010, when the idea of Magento2 was first beginning. At the time we discussed which framework it should be based on – and back then ZF2 was still in Beta, and there were only a handful of Symfony2 core components that had been developed. The framework itself wouldn’t be released for another year.

    Because of the state of both of those, it was felt by both Yoav and Dima that if they wanted to use either framework “seriously”, they’d need to delay development until either of them was officially launched, and even then development velocity would suffer because they’d be on the bleeding edge.

    However, we’re now 4 years later, which is an eternity in IT terms, and both of these frameworks are now very mature and the de facto standard for PHP applications.

    Laravel as already been mentioned, but I think that’s probably sitting where ZF2 was back then – not sufficiently mature, or sufficient market penetration to be able to bank on.

    Whether or not to adopt a different framework this late in the day needs to be a product owner decision (IMO). They need to be able to understand what the business and product benefits will be for the amount of development effort (and lost time) it will take to make the change. How you quantify intangible benefits such as “a larger pool of competent developers” I don’t know (but I suspect a PO would be able to turn that into a monetisable value).

    I think this is the wrong forum to be asking… people reading this blog are techies, so yes, they want change, and they want the latest and the greatest. But they likely won’t consider the economic cost of that, and whether the cost even makes that change viable, or if a ROI will ever be seen from that change. That’s why we have POs.

    FWIW, I say the pragmatic answer is to stick with ZF1. It’s not ideal, but Magento2 is a refactor, not a rewrite. A change of framework will likely be more appropriate for Magento3, assuming that this will be a complete ground-up rewrite

  10. Hi and thank you for asking.

    Please consider two constraints :

    * Use a real, good, full featured Dependecy Injection Container, so we will be able to safely extend Magento, to properly mock Magento core in order to unit test our developments, and all others benefits.
    * Use a real, good, full featured Entity Manager component, whatever the underlying data storage should be (relational or document). We really need to consider our objects as business entities and not only as relational tables mappers. Please drop the active record pattern that prevent us to abstract and mock the data persistence layer.


  11. Magento 2 is currently implementing Zend 2 Core modules. Take a look at composer file: https://github.com/magento/magento2/blob/master/composer.json

    If this change needs to be discussed, I would suggest we carry it on the repository issue page itself so that developers who are actually contributing can have a proper voice.

    1. Thanks for pointing this out. I am investigating. >:-(

    2. Well, interesting. It looks like we have used some libraries from ZF2 for some time, it has just become more visible with the Composer work. It was not a fundamental platform decision. So we did not add a new dependency recently, but it has been clearer the dependency exists. Thanks for pointing this out. Going to dig into this some more for sure.

  12. I do agree with Valerio, since composer will allow us to use different modules from different frameworks then how about making Magento framework independent so that it can benefit from each module separately ex:. performance, stability, etc.

    1. Thanks for the comment. We are doing this in part already, but I think there is also advantage in consistency. Because we cannot mix versions of the same library, it does matter what Magento depends on. It can impact what extensions must also depend on.

  13. I’d go with Laravel. It’s an awesome framework and in my opinion the best out there at the moment. It uses a lot of Symfony 2 components too and is extremely modular. Laravel 5 is to be released soon also with some excellent improvements and additions.

    That said, I like the idea of making Magento 2 framework agnostic. That would be simply amazing if possible.

  14. Alan, I am developing a ZF2 application and I would like to use Magento as the ecommerce engine. Can you point me in the direction of any materials on how to integrate Magento (either 1.x or 2.x) into my ZF2 application? Also, is M2 CE available for download yet? I just saw 1.9.x available on the downloads page but I couldn’t find M2 anywhere.

    1. Magento is designed to provide a full experience, however M2 has a lot of web service based APIs (REST and SOAP) that might be useful. The task you are describing has so many alternative strategies, its pretty hard to give a precise answer. I suggest having a look at http://devdocs.magento.com/ to see if useful. Good luck!

      M2 has just be released in the past week – so M2.0 CE is now available (but was not when you created the post). So check again now – it should now be available.

      1. Thanks, Alan!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: