Since its birth, PHP has been liked by many programmers. It has become a good helper for Small and Medium-sized webmasters and has trained a large number of PHP programmers. However, with the increasing application of PHP, in many cases, it is not limited to applications for Small and Medium-sized websites. It is not uncommon for some large PHP projects.
When we select PHP to develop large projects, we have to consider issues such as development efficiency, development specifications, and post-maintenance. At this time, we often choose a development framework that people recognize, the popular Zend Framework, Yii, Symfony, CodeIgniter, and CakePHP all claim to be capable of developing large applications.
New frameworks are emerging, but when we apply these frameworks to implement products, there will always be various problems:
I. Large frameworks often have deep structural theories. The most familiar ones are the well-known theoretical terms such as MVC and ORM, and there is also a lot of in-depth Object-Oriented Knowledge, however, there are only a few people who really know this, which makes the application threshold rise sharply. In addition, the application details in large frameworks are even more complex and the learning cost is relatively high, this is especially embarrassing for PHP, which was originally used to locate small and medium-sized applications.
2. As a scripting language, PHP runs based on host processes (such as apache and php-fpm ), in a single request, the system has gone through a series of processes, including process creation, Environment initialization, script compilation, engine running, output, resource recycling, and process destruction, at the programming language level, the overall operation efficiency is two to three orders of magnitude slower than that of compiled languages, with the consumption of a large amount of system resources, on this basis, we need to build and load a complex development framework, which increases the operating costs. In large applications, there is no special demand. Sometimes the efficiency of using PHP to add large frameworks is fatal.
3. There are too many factors to consider for large frameworks. developers need to pay extra attention to the details beyond the code when using applications, such: non-standard conventions, lengthy manuals, trivial configurations, complex file directory structures, difficult-to-limit rational constraints, and various class libraries make the development process of most programmers messy, it is also empty to improve development efficiency.
4. the most deadly point is that the framework author constantly looks for silver bullets and tries to create a monster that meets all needs. Large applications have high requirements on system loose coupling. Generally, data cannot be operated directly at the development level. See a simple SOA model (as shown in the figure below ), the data layer and the business layer are physically isolated, while the development of the business layer only accesses the service interfaces provided by the data layer. From the current PHP development framework (especially the MVC model), ORM is usually used to abstract database tables and perform CRUD operations directly, reliable large-scale applications won't do this (maybe suitable for VPS, but large applications will choose VPS ??).
To sum up, PHP large frameworks are still very embarrassing, but on the other hand, a good PHP large framework is really a good example worth learning, it contains a large number of knowledge systems, such as design concepts, design patterns, code optimization, language features, software engineering, and so on. It integrates the essence of PHP, but far exceeds PHP itself.
In the end, we still need to say first-class gossip to these large PHP frameworks, "the learners are born, and the users are dead ". Therefore, it is best to customize the development framework for large-scale projects.