State of PHP Feb 2012 – Symfony 2, Zend Framework 2, IDE Support, MySQL

There is just too much going on so I thought I should put these thoughts down so that I do not lose my mind from the excitement and anticipation that comes from things moving very fast and innovation being spured at a pace which is mind boggling.

PHP

In my opinion the stabilization of PHP 5.3 which introduced namespaces (similar to Java Packages) was the first shot across the bow, and I expect 5.4 with traits to bring even more reusability. However our hosting providers are slow to upgrade most are still running PHP 5.2, without general availability for 5.3 just starting to appear

Frameworks

There are two main frameworks in the bull pen Symfony 2 (http://symfony.com/) and Zend Framework 2 (http://zendframework.com/) currently in beta. However they are as different as can be. While Symfony 2 has been refactored from a full blown framework to a bunch of core reusable components, its moving towards ZF2, in that its not trying to be all MVC, forms etc, but is rather a set of building blocks to provide web application framework. So good is it that Fabien Potencier the lead developer has a series on how to build your own framework on top of Symfony at http://bit.ly/zVLi7X

ZF2 on the other hand is a bunch of reusable components which you can mix and match with other frameworks which also provides an MVC, ORM etc.

If you have been in the Java world, Symfony is more like Spring Source () while Zend Framework is Apache Jakarta (http://jakarta.apache.org/)

Interesting tweet that sums it all up:
Every time a developer complains about php, the #Symfony2 community creates another great, namespaced, decoupled and reusable component

IDE Support

Zend Studio 9 was let loose at ZendCon, Oracle released Netbeans 7 (which supports ZF1, and Symfony), Eclipse PDT is chugging along, PHP Storm from Jetbrains creating  a storm with others  Vim, Notepad++, Sublime Text basically all you need to do is pick your poison.

Communities

Github (http://www.github.com) is the new Facebook and LinkedIn for developers, where all the action is happening for all the major PHP communities, you had better be there. Forking and making changes is as easy as a button press. I am yet to push my first commit to a project but I am getting there.

MySQL

The best know web database is getting losta love from Oracle, and also the community led by Percona, SkySQL, Monty DB, and many others. Where it seemed lost with lost of FUD during the $1bn Sun takeover by Oracle, it seems to just be gaining steam (at least from my viewpoint as a consumer, developer and user). Now at 5.5, with 5.6 starting to appear over the horizon …

While there is a barrage of NoSQL solutions, Hadoop leading the charge, MySQL provides a NoSQL interface via HandlerSocket (https://github.com/ahiguti/HandlerSocket-Plugin-for-MySQL) and MySQL Cluster (http://www.mysql.com/products/cluster/)

Supporting Infrastructure

This is where all the fun happens, who is using the language and what are the trends. Here is a snapshot:

  1. Content Management Systems – WordPress is getting lots of love, while Joomla now at 2.5 supports databases other than MySQL. Drupal is adopting Symfony 2 as its core framework while Magento runs off a modified ZF1 kernel, while XOOPS (http://xoops.org) is being rewritten to use ZF1 or two
  2. Template Engines – an area where battles are found won, and lost. Smarty now at 3.0 (www.smarty.net), has to battle Twig (http://twig.sensiolabs.org)  which is surging due to its usage in Symfony 2
  3. Web services – JSON, XML, AjaX, Rest Interfaces are no longer buzz words they are the norm with native support being baked into PHP
  4. Object Relational Mappers (ORMS) are one of the core developer architectural choices, in PHP we have ZF Table (Table Gateway), Doctrine 1 (Active Record), Doctrine 2 (Data Mapper), Propel (not used) in addition to plain old PDO all of which provide rich choices. Interesting is that Doctrine 2 provides an mapping for MongoDB which shows its versatility similar to Hibernate for Java
  5. Continuous Integration – with Hudson and Jenkins, and now Travis which is also hooked into Github provides a great way to continuously monitor the quality of your development
  6. Quality Control – PHP Unit has always been there but now we have mess detectors, and other metrics (do not make sense of them yet), but whatever you want to measure there is probably a tool for it.
  7. UI Toolkits – JQuery took the world by storm with JQuery UI providing a set of theme-able components, but we have HTML5 boiler plate and Twitter Bootstrap which are simplifying the cross browser issues we developers face.
  8. Performance – always a PHP problem but it has improved through 5.3 to 5.4, and other techniques like OP Caches are becoming more maintream, Memcache is pre-built into Apache …

Exciting times to be a PHP web developer oopsss we are not web developers we are Software Mechanics (http://www.brandonsavage.net/the-mechanics-of-code/)

16 responses to this post.

  1. Posted by coderoad on March 1, 2012 at 08:01

    Reblogged this on Roshan Book and commented:
    A Nice Article comparing various PHP frameworks

    Like

    Reply

  2. nice update post, thanks

    Like

    Reply

  3. Nice article, but i’d like to add Dojo toolkit as a powerful JavaScript framework coupled with Zend_Dojo, its a beauty come true its one of the reason am stuck on Zend i just hope 2.0 is lot easier to grasp.

    Like

    Reply

  4. Posted by Willy on March 23, 2012 at 00:29

    After spending some time comparing Zend Framework 2 and Symfony 2, I wonder how you say they are “different as can be” ? From my point of view, it’s the other way around. They are very similar. They both use Dependency Injection, Service Locators, and most configurations can be injected through configuration files. Sometimes the similarity is scary, they’re both using Request and Response objects which can be used directly in their MVC. The only major difference I’ve seen so far is that zf2 doesn’t use an ORM by default, it will implement the TableGateway and RowGateway design patterns. Also, zf2 seems to be using an EventListener pattern at its core, I’m not surr about sf2. One thing is certain, both these frameworks rock when it comes to flexibility and performance.

    Like

    Reply

    • Willy,

      I have been using Zend Framework for the last 18 months, and I have found it to be pretty functional with regard to using the features that I need. However I have found it to be “overly” engineered in some places, and have had to look elsewhere for options.

      Symfony2 is a well integrated solution (currently in production), which has discrete components which can be used standalone. Infact I ended up using the Symfony2 validators over ZF validators because they were easier to configure with annotations and less code. More here http://wp.me/pXn3W-4C

      Symfony2 is the new wave of innovation in PHP which is a framework with standalone components – ZF now needs to catch up in ease of use and performance

      Like

      Reply

  5. Posted by Victor on November 27, 2012 at 08:12

    Nice article. Thanks for sharing!

    Like

    Reply

  6. Hi I would like to explain my problem and make some questions.

    I will have a huge resposability in my company. Code a system like youtube but for a private net over a tv company. So the basic ideia is share videos between reporters and it will have a good search engine.

    I have complete freedom to choose the technologies and money even to buy some of them. I am wondering to use Symfony or ZF. And I have just 2 mounths and a half to implement this system, me and a designer.

    I’ve work a little bit some time ago with zend, but for a personal use.

    My questions:
    1) What is the best IDE to work with Symfony? Could I work with Zend Studio?
    2) Which one has better documentation and examples? I will need to learn fast how it works! But I know how to code in PHP e how a MVC structure works.
    3) I will work with Linux and Apache, I know that is not the topic but I will have to choose a distribution based on Debian (that I’m familiar with it), Don’t you know some good one? with good support.
    4) Which framework has better extesions to code forms with ajax and top stuff from JS? like good integration with jQuery.
    5) Other tottally offtopic question is, good player for h264 videos?

    Tks!!

    Like

    Reply

    • Cassiano,

      Thanks for the questions, and as I pen a more detailed response, I will also share with other readers on my blog so that you get feedback from a variety of sources

      Stephen

      Like

      Reply

    • I would recommend Symfony2 over ZF2, at this time since its a more mature framework, has a great community, is modular in nature with many libraries contributed as bundles by the community (you may also want to look at Friends of Symfony – like a PEAR library of solutions)

      1. The best IDE is the one you are familiar with, that said you can look into Zend Studio 9, Sublime Text (have not used it), Netbeans and PHP Storm

      2. Both ZF2 and Symfony2 have similar learning curves, but SF2 has been out longer so has more examples.

      3. I am not strong with Linux but seems like Centos (based on RedHat) would be in the lead here followed by Ubuntu which has momentum behind it at this time, but I could be wrong.

      4. Both frameworks have similar support, but I suggest you look at Twitter Bootstrap (found it to be a great lifesaver), though lacking a calendar and date picker (at the time I wrote this HTML Web Toolkits – Twitter Bootstrap)

      5. H264 videos, that is a tough one, try JW player (http://www.longtailvideo.com/jw-player/)

      Wishing you the best in the project, also remember to please share your experiences so that others can learn from you

      Like

      Reply

      • Thank you so much for the reply! After read a lot I chose, like your sugestion, the SF2. So I gonna use: SF2 + Netbeans 7.2.1 + Doctrine 2 + Smarty. I will take a look in the Twitter Bootstrap and JW player.

        I didn’t start to code yet because I’m working in another huge problem: make a cluster with 4 servers, 2 in one city and 2 in another, and probably we gonna user Windows Server + SQL Server for the replication (I’m studing a lot because I’ve never worked on this, and we gonna need to install all the hardware and software). The old implementation of the system (the sharing video system) uses SQL Server so to implement this fast we gonna reuse a lot of code from desktop interface (C#). My wish is to use linux + apache, but I thinking to use IIS to run php on windows server. Don’ t you know which one is better to run over the windows, apache or IIS? (talking to run my SF2 project, the web interface for the system)

        Like

        Reply

        • 1. My advice on the SQL Server solution is to post your question to the Stack Overflow Database Administrators forum (http://dba.stackexchange.com) I am sure that you will get options there

          2. You may want to also look at Netbeans 7.3 Beta (Seems to have some great bindings for Symfony2) and I would suggest you look at Twig (http://twig.sensiolabs.org/) which is inbuilt into Symfony2

          3. Based on what I have been reading IIS has become a great platform for running PHP apps, so I would suggest you look at Microsoft WebMatrix (http://www.microsoft.com/web/webmatrix/). If that does not work you can use WAMP server (Apache + PHP on Windows – http://www.wampserver.com/en/) and not install the MySQL component however this should be the last resort as it adds more complexity to the architecture mix

          4. Since you are going for a brand new project I would recommend the latest version of PHP (5.4), SF2, Doctrine2, JQuery and Twitter Bootstrap as well.

          Once you make your bed, you will find ways to sleep in it. I hope this helps

          Like

          Reply

          • 1. Cool! I will pass the information to my patner that is working on SQL Server replication solution.

            2. Hmmm I didn’t read about the Netbeans 7.3, but I’ll give a try. I will look at Twig too, I’ve just like the Smarty because the netbeans has support inside.

            3. Good to know that IIS has this reputation with php. Webmatrix I’ve worked with asp.net/c# and Umbraco and I didn’t like it, too much controled by them. In a fast google search, I read that apache don’t have a good performance over windows, but I not sure yet, need to read more about it. But with we chose work on windows probably gonna be windows server + sql server + iis + php (web interface) + C# (desktop interface). If we chose work with unix (my dream) we gonna use Apache for sure.

            4. PHP 5.4 it was in my mind like the other technologies that you said.

            I am very excited and anxious to start working with this bunch of web technology, but first we gonna need to figure out the hardware structure 😦

            Like

            Reply

            • 1. Obviously your database selection is done, but if you consider using MySQL, with 5.6 there is improved replication support (also works well with C#) so you can have your Linux dream.

              2. Twig is new but offers the same functionality as Smarty without the additional overhead, you can read more about the history here (http://fabien.potencier.org/article/35/templating-engines-in-php-follow-up). Also since its integrated into the core of SF2 means that you do not have to add a 3rd part component

              Wish you the best in your project, please let me know how you progress

              Like

            • 1. So, SQL Server + IIS it is because we have some webservices implemented on it, but one guy gonna study how hard it is to translate it to use over Apache. I’ve read about the replication support over MySQL ($440,00 + tax) and PostgreSQL (free) too, but I need really good arguments to convince the team to stop use windows tecnology. The most important argument is if I could prove that it will be faster, easy to implement the unix solution over all that is working, but it will be easier on the next project.

              2. Good to know this about twig, I read what you wrote before but just know the information really arrived inside my brain hahaha

              Ok, I will try to remenber to post here what we decided.

              Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.