Comparative analysis of the pros and cons of mainstream PHP frameworks, comparative analysis of framework advantages and disadvantages _php Tutorial

Source: Internet
Author: User
Tags php framework codeigniter zend framework

Comparative analysis of the pros and cons of mainstream PHP frameworks, comparative analysis of framework advantages and disadvantages

PHP is a popular open source server-side scripting development language both at home and abroad. Able to adapt to the development needs of large and medium-sized projects. In this article we will introduce several mainstream PHP framework and its related advantages and disadvantages of the evaluation, as a reference to share to friends.

The main reference PHP frameworks include: CodeIgniter, CakePHP, Zendframework, Symfony. I have no serious use of many frameworks, just a simple trial, may be a lot of ideas immature or wrong, please correct me, grow together.



1. Simple configuration, all the configuration using PHP script configuration, execution efficiency, with basic routing capabilities, to a certain degree of routing, with the initial layout function, to create a certain degree of interface appearance; database layer encapsulation is good, with basic MVC function

2. Fast and concise, code is not many, high performance, PHP framework is simple, easy to use, low learning cost, document details; With a lot of easy to use library, framework for small applications


1. Simply understand the model layer as a database operation

2. PHP Framework is simple enough to meet small applications, slightly less able to meet the needs of midsize applications


Overall, take CodeIgniter to complete the simple and fast application is worth, at the same time can construct a certain degree of layout, easy to reuse the template, the data operation layer is good encapsulation, and codeigniter not use many too complex design patterns, Good execution performance and code readability. As for the additional library is also good, concise and efficient.



1. CakePHP is the most similar to ROR PHP framework, including the design method, the database operation of the active record mode, the design level is elegant, no redundant library, all the functions are purely framework, execution efficiency is good; database layer HasOne, Hasmany function is very powerful, more suitable for complex business processing, routing function, configuration function is good, automatic building scaffolding (scaffold) is very powerful, suitable for medium-sized applications, basic implementation of MVC every layer, with automatic command line script function;

2. Document comparison of the whole, in the domestic promotion of comparative success, most of them know cakephp, learning costs Moderate


1. The very serious problem with cakephp is that the model is understood as a database-level operation that severely affects operational capabilities beyond the database

2. CakePHP's cache function is slightly weak, the configuration is slightly weak; cakephp is not suitable for large-scale applications, only for medium-sized applications, and small-scale applications are slightly more expensive to learn


In general, the cakephp framework represents a very important era and representative of the PHP framework, and is now playing a very important role, many of their own framework has been modeled as a model of cakephp, is a milestone product CakePHP reveals that Ror's agile approach to development and the idea of database manipulation as the only model is a great tool for developing rapid applications and prototypes, and the development framework used to make Web2.0 websites is also worth choosing.

  Zend Framework


1. The official production, with a very large library, the framework itself using a lot of design patterns to write, architecture is elegant, the implementation of moderate efficiency; MVC design, relatively concise, with routing capabilities, configuration files are more powerful (able to handle XML and PHP INI), the various libraries are very powerful, is the most comprehensive of all PHP frameworks, including not only a PHP framework, but also a large class library (instead of pear), which is its main feature, can be intuitive to support in addition to the database operation of the model layer (more than CodeIgniter and CakePHP strong), and can easily use the loader function to load other new added Class;cache features are very powerful, from the front-end cache to the back-end cache support, back-end cache support Memcache, APC, SQLite, files and so on, the database operation function is very powerful, Supports various drives (adapters)

2. The document is very full, in the domestic community is very mature, and at present a lot of Web 2.0 sites in use, learning cost medium


1. The MVC function is relatively weak, the view layer is simple to implement (as is not implemented), not very powerful control of the front-end page

2. No automation script, create an application, including the portal file, all must be built by hand, the cost of entry is high

3. The Zend framework as a medium-sized application framework is not a problem and can barely be used as a PHP framework for large applications, but as a very mature large PHP framework, some effort is needed


As an official framework, the ambitions of the Zend framework are predictable, to squeeze out other frameworks, to encapsulate many powerful libraries, to provide one-stop framework services, and their development teams to be strong enough to develop powerful products. So the basic certainty is that the Zend framework will be promising, if it takes more time to refine the framework. Similarly, the Zend framework architecture itself is more elegant, indicating that the Zend official is a lot of experts, the design concept is more advanced, although some of the features are not perfect, such as the view layer, automation scripts, and so on, these depend on the future upgrade. In general, the Zend Framework is the most anticipated PHP framework, and of course, it is absolutely no problem for you to invest in your project at the moment.



1. Symfony is the most powerful PHP framework I know, and I have been using it for a long time, but many features have not been dug out; it has completely implemented the MVC three layer, encapsulating everything including $_post,$_get data, exception handling, debugging functions, data detection , including powerful cache function, automatic loading class (This feature is very cool), strong i18n support, powerful view layer operation, can be fragmented to contain a single multiple files, very powerful configuration features, using YML configuration to control all framework and program operation Behavior, strong enough to make people without words , you can easily define your own class, and symfony can automatically load these classes, can be called at random in the program, including powerful multi-level project and Application management: Project--Application-- Module-to-action to meet the needs of multiple applications under one project, and each layer can define its own class library, configuration file, layout, and very powerful command line operation functions, including building projects, building applications, building modules, refreshing caches and so on;

2. Symfony is definitely the first choice for the development of large complex projects, because the use of symfony, will greatly save development costs, and when many people collaborate, there is no problem, after the project level is defined in the basic class, any module can be reused, greatly reuse the code


1. The database operation model uses heavyweight propel and Creole, but has moved them to the addon in the version I tested, which can be used

2. The cache function can not be controlled, each development debugging always cache, need to execute Symfony cc, Symfony RC to clear and rebuild the cache;

3. Efficiency is not very high, especially the process of parsing templates and reading configuration files, it takes a lot of time;

4. The cost of learning is very high, and there is no mature community and documentation in China, even the Chinese manual is not, the corresponding to master all functions, it takes more time


Symfony is definitely an enterprise-class PHP framework, the only thing that can seem to be able to compete with the Java field of the strong framework of things, strong things, natural learning complex, but corresponding to the development of the project is also helpful, nature is recommended complex projects using Symfony to deal with, feel is worth, The later maintenance cost is lower, the reusability is very strong. Corresponding if the use of symfony should be more complex Internet projects, then the corresponding to consider the problem of database distribution, then you need to abandon the symfony of the database operation layer, need their own definition, of course, symfony support arbitrary structure of the model layer.


The above PHP frameworks are unique and open source projects, but the framework for the project is different, generally codeingiter is more suitable for small projects, CakePHP and Zend framework is more suitable for medium-sized projects, Symfony more suitable for large heavyweight projects, When selecting a project, consider the customization and extensibility of the framework, as each project cannot determine whether you will change as your needs change.

Relatively speaking, the Zend framework and the Symfony have a strong ability to cope with change, especially if you can customize the class of the model layer, it is very convenient to add their own business or data processing classes, I am a personal comparison recommended in large projects in the use of PHP framework.

Codeingiter and CakePHP also play a significant role in small and medium-sized projects, rapid development and prototyping, and are well suited for the development of prototype projects that are not clearly targeted. true techarticle Comparative analysis of the advantages and disadvantages of the mainstream PHP framework, comparative analysis of the advantages and disadvantages of the framework PHP is a popular open source server-side scripting development language both at home and abroad. Able to adapt to large and medium-sized projects ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.