Wednesday, December 26, 2012

TOP 5 most popular PHP frameworks of 2012

TOP 5: Google Trends 2012

Let’s look at what people were searching for this year. I’ve put five assumingly most-popular frameworks and that’s what I’ve got:



If we look at the exact numbers, the TOP 5 looks like this: Codeigniter: 90 Yii: 62 CakePHP: 61 Symfony: 50 Zend Framework: 44 Of course, we cannot really judge about popularity only from the amount of searches. So we dig deeper.

TOP 5: Google Search Results 2012

Second test I’ve performed was just a search on the keyword in Google and then narrowed it to “Past year”. Here are the approximate amount of the results:

  • Yii: 861 000 
  • Codeigniter: 660 000 
  • CakePHP: 606 000 
  • Zend Framework: 465 000 
  • Symfony: 329 000 

Of course, again, here we have some extra factors. This amount is only approximate and it might depend on my computer – you know, every one of us get slightly different search results on Google. But, as I understand, the difference is in the ordering of the results, but not so much in the total amount of it.

TOP 5: Job search (oDesk + Elance)

The third and final part of my mini-research was job boards for freelancers. I’ve searched two of them – oDesk.com and Elance.com. Again, the test was simple – just putting the keyword into the text-based search field and counting the amount of results. Here we go:

  • Codeigniter: 136 (101 from oDesk + 35 from Elance)
  • CakePHP: 124 (79 + 45)
  • Zend Framework: 54 (39 + 15) Yii: 47 (30 + 17)
  • Symfony: 40 (27 + 13)

As we can see, in this case we have two clear leaders. Overall result and conclusions
So what can we take from these mini-tests?

  • According to the best performance in all these tests, the best framework in the market is CodeIgniter.
  • Zend Framework is on a decline. If we compared the data to 2008-2009, we would have found bigger numbers on that framework. I am not saying it is not worth to check out, but it seems that developers switch to something new and fresh from this old framework. I have worked with it on several projects and can also recommend it for your needs. 
  • Yii is really worth to check out. If we believe these numbers, there are a lot of articles on this one, and perhaps it is only a matter of time for job boards ads to be higher for Yii.
  • CakePHP is a really good perspective in terms of job and project search.
  • Symfony is not that popular. Strong fifth place, of course, is not so bad – none of other frameworks I tried to bring to this survey showed similar results.

How to test your regular expression (regex)?

I found a perfect website for this job. http://regexpal.com/

Jquery, Javascript – .replace is not a function

Basically, I wanted replace some part of a string then trim white space from the beginning and end of a string. The standard answer on the internet is as follows:

var text = "asd (Some text)";
var txt = text.match(/([a-zA-Z0-9 ]*)/g);
txt = txt.replace("text", '');
txt = $.trim(txt);

I eventually realized that “.replace” is only a function when the operand is a string; in my case, selectedtext was an object, and therefore I needed to cast it to a string, as follows:

txt = txt.toString().replace("text", '');

This then gave me the correct result.