APP startup project-PHP framework selection this article will discuss the development framework based on PHP after "APP startup project-backend language selection. Since its birth, PHP has seen hundreds of large and small frameworks. some people say that PHP is born with a free language against the framework, and the use of the framework will reduce the performance of PHP. Indeed, the introduction of a complex architecture reduces performance, but I think from the perspective of teamwork, development based on a unified framework will contribute to cooperation and future expansion. The superiority and inferiority of the framework are related to the program performance and development efficiency. the performance and development efficiency are often a contradiction in the programming field, just as C and JAVA, it is famous for its performance and popular for its development efficiency. Finding a balance in a conflict is never right or wrong.
Among the many PHP frameworks, there is still a balance between performance and efficiency. Laravel, the well-known one, is called the most elegant framework. Yaf and Phalcon are hailed as the fastest frameworks, there are also well-known frameworks such as Yii, Codeigniter, and Zend Framework. It is not to say that elegance is not good or that it is not elegant. this is just a relative evaluation. So how should we select the framework?
First, what is the basis for selection? Is it performance or efficiency?
Although the big word "Love beautiful code? We do too. it shows its elegant characteristics, which does not affect the elegance of Phalcon, Yii, and Zend Framework, and does not significantly improve the development efficiency, however, the performance gap between different frameworks is obvious. See Performance Comparison. This webpage compares the framework performance from the perspectives of JSON, single Query, and multi-Query. in addition to PHP native, phalcon-micro, Yaf, and Phalcon all show several times higher performance than Laravel.
2. how much does the framework need to do? Is it an all-inclusive nanny or a simple dad?
The all-inclusive nanny framework helps you think carefully like a nanny, and you cannot live independently. This type of framework should take into account all aspects of WEB development as much as possible. The framework has many restrictions on the development mode. developers are advised to follow the restrictions. smaller projects will become efficient and easy. with the development going deeper, it will gradually become a dilemma between limitations and breakthroughs.
The simple father-type framework provides you with guidance in the general direction like dad, and small details give you full freedom. This type of framework only implements the framework. Route, MVC, Request, Response, AutoLoader, ORM, Cache, ACL, and other important functions are freely implemented by developers.
Phalcon and Laravel are well decoupled in their Architectures. they can be either nanny or dad. Phalcon also provides a simplified Phalcon-micro framework to further improve performance.
The following is a brief analysis of Phalcon, Yaf, and Laravel.
Phalcon
Developed and compiled based on Zephir for php c language extension, designed for high performance.
The Phalcon team provides Zephir, a language that is highly similar to PHP and is dedicated to compiling PHP extensions. developers can develop PHP extensions based on Zephir development projects, such as database connection components, when connecting a PHP project to a database, you need to write the user name and password to the configuration file to obtain the account password. if you compile the database connection part into a C extension, to a certain extent, the security of user names and passwords can be ensured. For common and finalized core components of the team, it can be compiled into C extension. Based on this development, developers can improve performance and protect core code. Compilation of all commercial software into C extensions is not a problem.
The core of Phalcon is based on the idea of dependency injection, and the plug-in and middleware mechanisms are based on the event-driven model. Dependency Injection manages runtime resources, and event-driven programming provides developers with the possibility of extending the framework.
Phalcon-micro facilitates lightweight application development.
Phalcon code organization is highly similar to Zend Framework for ease of use.
It is not possible to perform breakpoint debugging within the framework. new users are not familiar with the framework during development. when there is an unknown problem in coding, there are only two ways to debug the framework, the first is to listen for events in the framework and determine the business logic. However, this method is limited by the event throw location and the observed data is limited. Second, using the Zephir language to modify the framework source code and re-compile it, which is time-consuming.
Yaf
Developed in China, most Baidu projects are developed based on it. Like Phalcon, C is compiled and compiled into PHP extensions, with the same performance as Phalcon-micro. It is a super lightweight framework, which is implemented by developers in addition to the core MVC. it is suitable for experienced developers for large-scale project development, and there is almost no developer community. Like Phalcon, it cannot perform in-framework debugging.
Laravel
The most popular PHP framework on GitHub, which is several times more active than the developer of Phalcon, is famous for its beautiful code. The project code is artistic, and even the command line is named by artisan. The framework is fully decoupled and provides a variety of components. The development style is similar to that of the Python Django framework. However, the code style is too unconventional. for example, the first-level registration of the core code is Illuminate, and the ORM is represented by Eloquent. it may be unfamiliar if you have experience with other PHP frameworks.
Summary
This article analyzes the basis for selecting a framework and compares the advantages and disadvantages of the three frameworks Phalcon, Yaf, and Laravel. If your team is not very interested in C extension to improve performance and has insufficient development experience, we recommend Laravel. if your team has a deep understanding of the design model, have some research on the PHP Framework source code and have the ability to modify and extend the Framework source code. we recommend that you select Phalcon. if you have experience with Zend Framework, you should select Phalcon; if you want to write your own framework from scratch, consider using Yaf. Frameworks such as Yii, Codeigniter, and ThinkPHP are not analyzed one by one, and they do not affect their existence as an excellent framework.
---------------
In addition to the [FW] and news articles, this site is an original article. for details, please note:
Source: Coming X
Original article: APP startup project-PHP framework selection
---------------