The PHP framework cannot afford to hurt. it cannot afford to hurt a framework wind since Rails, and response from other languages, such as Java, Python, Scala, and PHP, no matter static dynamic language, a framework that imitates the Rails mode appears. among them, the framework productivity of the PHP language is even better. the mainstream PHP Framework PHP framework cannot afford to hurt.
Since Rails blew up the framework wind, other languages started to respond, Java, Python, Scala, and PHP, regardless of static dynamic languages, there were frameworks that mimic the Rails mode. among them, the framework productivity of the PHP language is even more advanced. there are more than five mainstream PHP frameworks. if you cannot add a framework, I estimate that there are at least 20 or more frameworks, which are terrible !!
The path to PHP frameworks has always been controversial. from the absence of PHP frameworks, to the absence of imitation of Rails, the growth of PHP frameworks cannot be achieved, an article entitled "Top 10 most popular PHP frameworks abroad" can be published simply by listing some frameworks and introductions on the Internet. PHP frameworks are well-known: small and medium frameworks such as CodeIgniter and CakePHP, and large frameworks such as Zend and Symfony. I have been wondering why there are so many PHP frameworks?
1. PHP development framework is too easy
Don't Scold Me. To be honest, the threshold for developing a Web framework in PHP is much lower than that in other languages. PHP itself already has Web support and wants to build a framework, write a single entry index first. php, and then use the module and action parameters to execute the corresponding Controller class, and View code. a very simple framework is ready, and skilled programmers will finish it in a day or two. If it is too simple, encapsulate $ _ REQUEST, $ _ SESSION, and database operations. Here, a model PHP 'mvc framework' is basically released. Skilled programmers have completed this operation in a week.
On the contrary, in other languages, taking ruby as an example, simply implementing REQUEST processing, parameter parsing, and other basic functions is far more than a week's work. in addition to the high flexibility and complex syntax of ruby, the effort required by the developer to develop a framework greatly exceeded the average. The low threshold for developing a framework is one of the factors leading to the proliferation of PHP frameworks.
?
2. weak PHP encapsulation capabilities, resulting in insufficient flexibility of the framework
This is also the fact that PHP has many frameworks, but it is generally necessary to evaluate the project and select an appropriate framework. for a simple web project, CodeIgniter and CakePHP frameworks are generally selected, for large applications, Zend, Symfony and other large frameworks will also be selected, because you will find that Zend and CodeIgniter are totally different.
Maybe I have abstracted it. for example, in the default PHP environment, there is no AOP function, and the existing methods of the class cannot be functionally enhanced, to implement similar functions, you need to display and modify the code outside. the most popular practice is to use PHP magic functions, but you still need to modify the object creation method.
Compared with Ruby, Ruby has almost built-in support for AOP, allowing you to enhance functions without changing external calls.
In the encapsulation of the framework, the difference in this capability is even more significant. in PHP, the high complexity of the framework also increases the difficulty of users, rather than completely hiding complexity inside the framework like Ruby. (This is also true for javascript, which is evidenced by jquery ).
?
3. the implementation mechanism of PHP makes the framework performance a criticism
In the PHP running mode, all resources will be completely released at the end of each request, which makes the loading of the framework a performance burden that cannot be ignored. even if you don't mind the high complexity of using large frameworks mentioned above, this also prevents you from easily using large frameworks such as Zend in small and medium-sized projects. It also limits the capabilities of the framework.
According to my analysis, there are so many PHP frameworks for these three reasons, but none of them have become the mainstream. This situation may not be a good thing. in Ruby, Rails is uniform, which makes the Rails community prosperous unprecedentedly. many Ruby experts develop various plug-ins to enhance its functions. So that it has a very benign development. Jquery has the same experience in the js framework.
In PHP, experts are constantly contributing to their new frameworks. To be honest, I personally feel that the help is very limited, but it is even more confusing, in fact, many frameworks can be combined into a development. rather than a 100-60-point framework, it is better to have a 100-point framework. I can't afford to hurt the PHP framework .?