Should PHP Developers Learn the Newest Frameworks or Stick to the Classics?

PHP, much like most programming languages is very slow to evolve. If you coded PHP five or even ten years ago and know the basics of object oriented programming then you will still be able to read and write PHP code today. Even when a new branch is released, the adoption rate is very slow and developers are reluctant to use new features since their code won’t be portable if moved to an older shared server using an older version of PHP.

However, unlike .NET and Ruby on Rails, PHP is just a language and not a complete framework. Although PHP alone will suffice for small sites that require minimal PHP code and are mostly HTML, when you start building medium to large scale projects you really need to use a framework. A Model View Controller (MVC) Framework will keep your code organized and divided and will allow you to re-use code in the framework for common tasks shared between most typical web projects (login, roles and permissions, forms, grids etc…). The question every new PHP developer asks is “what framework should I learn?”

So what framework should you learn?

My First introduction to the MVC paradigm was through Zend, one of the oldest and heavily used PHP Frameworks. I didnt have a choice since I was taking over a project from an Indian team and learned a lot about the framework from learning their code which I had to work on. Zend, like older frameworks is somewhat bloated and slow. It tries to get involved in every aspect of your website (zend buttons, zend forms etc…). With older mature frameworks like Zend and Symfony2, even a simple Hello World page has a lag due to the overhead of the framework. The upside is that these two beasts have been around for a while, have a stable and robust code base and a huge community.

Zend drop off

I was tasked with starting a new large scale project about two years ago and did some serious research into PHP frameworks at the time. I chose to go with Yii, it was very popular, brand new, fast and cool. It came with code that would pre-build your models from a database schema including foreign relations which work with Yii’s active records. Im still working on this project today and have been happy with the framework, however, as time passed, so did the fad. Newer cooler and faster frameworks came out and the Yii community went down to 7.6% of PHP projects (see graph below for popularity of various PHP networks).

When starting my next large project should I jump on the bandwagon and start learning Laravel or Phalcon or continue with Yii or Zend? Once Yii2 or another new framework comes out, support for Laravel and Phalcon will go down as new developers look for the latest and coolest. Furthermore, new frameworks may not have stable code nor a lot of help forums to research issues. There is a steep learning curve in tackling a new framework and it’s not worth it for just one project if you know another framework better.

In conclusion, most of the MVC frameworks available today are more or less the same. They provide a secure skeleton that forces you to keep your code organized and can speed up development if you know the syntax well. Once you have learned a framework well, stick with it! Join communities, help out beginners and even consider contributing to its code base or reporting bugs. Like a programming language, the issue is less about which one you choose and more about how you use it. Don’t take shortcuts or hack the framework, use it as it was meant to be used