Hi, Habr. Every year the number of frameworks increases, forks appear, some become fashionable, and some go out of fashion. Of course, different frameworks provide the developer with different opportunities, which primarily depend on the developers, their ideas, the chosen architecture, the availability of documentation ... and of course the size of the framework. Here we also will talk about this parameter today - I will ask all interested under kat.
Let's look at the question from the perspective of a novice. Here he has already learned the basics, he writes something on the “native” php. Gradually comes to such a thing as "framework". And now he is already interested in this question, which frameworks are the most popular, which have the documentation in Russian, and which have the community. However, there is still such a parameter as complexity or threshold of entry. And if he asks for advice on the forum, then he will most likely be advised by Codeigniter or Kohana (more rarely Yii) than Zend Framework or Symfony. And this is quite logical and normal.
')
Is a large volume framework good or bad? What is better: good speed or great architecture and great features? We will leave these questions for the following articles, and today we will look at the smallest and largest and most voluminous frameworks. And we will count the number of lines and the number of files.
In the network you can find information about the number of lines of a framework. But this information seemed to me unreliable and rather outdated (for 1-2 years I consider a large gap in the it industry), so I decided to get this data myself by counting. This raises the question: what exactly will we consider? Reflecting on this question, I came to the conclusion that the following parameters should be counted:
- Number of lines and files in the entire framework
- Number of php files and lines in them in the whole framework
- The number of php files and lines in them in the whole framework, excluding third-party components
For this purpose, a small php script was written that recursively got all the files in the folder, opened them and counted the number of lines. Also simultaneously save the number of files.
Popular frameworks (if I forgot your favorite one - write, add) and several CMS / CMF for clarity took part in the experiment. When measurements were used the latest versions from the sites of developers.
As a result, I received the following data:
Object of study | Fully | Php files only | Only php files (without third-party modules) |
---|
Kohana 3.3.0 | | | |
of files | 1283 | 862 | 471 |
rows | 183228 | 119023 | 56874 |
Codeigniter 2.1.3 | | | |
of files | 352 | 147 | 147 |
rows | 88724 | 51525 | 51525 |
Yii 1.1.13 | | | |
of files | 2005 | 1621 | 1571 |
rows | 653970 | 614712 | 573114 |
Zend Framework 2.1.3 | | | |
of files | 2070 | 1963 | 1963 |
rows | 276248 | 272957 | 272957 |
Symfony 2.2.0 | | | |
of files | 5718 | 3583 | 2247 |
rows | 498788 | 418988 | 253408 |
CakePHP 2.3.0 | | | |
of files | 1012 | 654 | 654 |
rows | 251125 | 238350 | 238350 |
FuelPHP 1.5.2 | | | |
of files | 700 | 473 | 455 |
rows | 166730 | 96074 | 73118 |
Drupal 7.2.0 | | | |
of files | 1056 | 269 | 269 |
rows | 314574 | 150999 | 150999 |
Joomla 3.0.3 | | | |
of files | 4753 | 1651 | 1651 |
rows | 517145 | 303996 | 303996 |
Wordpress 3.5.1 | | | |
of files | 1085 | 447 | 447 |
rows | 312529 | 192473 | 192473 |
And if you find an approximate number of lines per file (the calculations used data "only php files without third-party components"):
Object of study | Lines / file (average) |
---|
Kohana 3.3.0 | 120.7515924 |
Codeigniter 2.1.3 | 350,5102041 |
Yii 1.1.13 | 364,8084023 |
Zend Framework 2.1.3 | 139,0509424 |
Symfony 2.2.0 | 112,776146 |
CakePHP 2.3.0 | 364,4495413 |
FuelPHP 1.5.2 | 160,6989011 |
Drupal 7.2.0 | 561.3345725 |
Joomla 3.0.3 | 184,128407 |
Wordpress 3.5.1 | 430,5883669 |
So let's analyze the data. The largest (by the number of files) in the standard package is the symfony framework, and the largest one is Yii. The most concise (least files) is Codeigniter.
According to the average number of lines in the file, the frameworks were divided into 2 groups: 110-160 lines in the file (Kohana, Zend, Symfony, FuelPHP) and 300-500 lines in the file (Codeigniter, Yii, CakePHP), and the middling and not. Most likely this is due to the architecture and you should not take it very seriously.
As for the CMS / CMF, the results are very expected and may contain a large error, because They include a fairly large number of elements related to the frontend.
In conclusion, I would like to note that the results turned out to be quite predictable. However, strongly focus on such a parameter as the size of the framework is not worth it. The programmer, knowing all the pros and cons of each option, must choose a tool for a specific task and use its advantages.
UPD: The comments suggested comparing the number of characters without comments. I did the following test: only php files, no comments, hyphenation, count the number of characters (utf-8 is taken into account).
Object of study | Symbols (no comments, hyphens, third-party libraries) |
---|
Yii 1.1.13 | 13248904 |
Symfony 2.2.0 | 5769403 |
CakePHP 2.3.0 | 5365166 |
Zend Framework 2.1.3 | 5334742 |
Zend Framework 2.1.3 (without Res / lang) | 4924887 |
Yii 1.1.13 (without i18n data and messages) | 1811665 |
FuelPHP 1.5.2 | 1209799 |
Kohana 3.3.0 | 841022 |
Codeigniter 2.1.3 | 616417 |