The pros and cons of several mainstream PHP frameworks

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

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. CodeIgniter Advantages: 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, not much code, high performance, PHP framework is simple, easy to use, low learning cost, document details; With a lot of easy to use library, the framework for small applications disadvantage: 1. The model layer is simply understood as database Operation 2. The PHP framework is simple enough to meet small applications and is slightly less able to meet the needs of mid-sized applications: overall, it is worthwhile to take CodeIgniter to complete a simple and fast application, while being able to construct a certain degree of layout to facilitate the reuse of the template, the data operation layer is packaged well, And CodeIgniter does not use many too complex design patterns, performing performance and code readability are good. As for the additional library is also good, concise and efficient. CakePHP Pros: 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 each layer of MVC, with automatic command line script function; 2. Document comparison whole, in the domestic promotion of comparative success, most of them know cakephp, learning cost medium disadvantage: 1. CakePHP's very serious problem is that the model is understood as a database-level operation, which seriously affects the ability to operate beyond the database by 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 have a slightly higher cost of learning: In general, the cakephp framework represents a very important era and representative of the PHP framework, And now play a very important role, many of their own framework has been copied to imitate the way of cakephp, is a milestone product; CakePHP revealed Ror's agile development approach and the idea that database operations were the only modelIt is a great tool to develop rapid applications and prototypes, and the development framework used to make Web2.0 websites is also a good choice. Zend Framework Benefits: 1. 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 drivers (adapters) 2. 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 disadvantage: 1. The MVC function is relatively weak, the view layer is simple to implement (as with no implementation), not very powerful control front page 2. Without an automated script, creating an app, including a portal file, must be built by hand, with a 3 higher cost of entry. 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, there is still some effort to evaluate: as an official framework, the ambitions of the Zend framework can be foreseen, Trying to squeeze out the other frameworks, encapsulating a lot of powerful libraries, providing a one-stop framework service, and their development team is strong enough to be able to develop very powerful products, so it's almost certain that the Zend framework is 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. Symfony Advantages 1. Symfony is one of the most powerful PHP frameworks I've known, and I've been using it for a long time, but a lot of features haven't been dug out; it's fully implemented MVC layer three, encapsulating everything, including $_post,$_get data, exception handling, debugging function, 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 the YML configuration can control all the framework and program running behavior, strong enough to be silent, can be very casual to define their own class, and symfony can automatically load (auto load) These classes, can be arbitrarily called in the program Includes powerful multi-layered project and Application management: Project----application----------to meet the needs of multiple applications under one project, and each layer can define its own class library, configuration file, layout , very powerful command line operation function, 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 many people collaborate, there will be no problems, after the project level is defined in the basic class, any module can be reused, greatly reusing the code disadvantage: 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 for 2. The cache function cannot be controlled, each development debug always caches, need to execute Symfony cc, Symfony RC to clear and rebuild the cache; 3. The efficiency is not very high, especially the process of parsing templates and reading configuration files, it takes a lot of time; 4. The study cost is very high, and the domestic does not have the mature community and the document, even the Chinese manual does not have, the corresponding need to master all functions, needs to spend more time to evaluate: Symfony is an enterprise-class PHP framework, the only thing that seems to be able to contend with the strong framework of the Java field; Natural Learning Complex, but corresponding to the development of the project is also helpful, nature is recommended complex project use Symfony to deal with, feel is worth, later maintenance cost is lower, 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. Summary of the above PHP framework, each has a unique, and are open source projects, but the framework for the project is not the same, generally codeingiter is more suitable for small projects, CakePHP and Zend frameworkRelatively suitable for medium-sized projects, Symfony is more suitable for large-scale projects, in the project selection, to take full account of the framework can be customized, extensibility, because each project is not sure whether you will change with the needs of 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.

 

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: info-contact@alibabacloud.com 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.