Switch] comparison between mainstream PHP frameworks (Zend framework, CakePHP, codeigniter, symfony, thinkphp, fleaphp)

Source: Internet
Author: User

Zend framework

Advantages:

Zend framework applies a large number of new object-oriented features in PhP5: interfaces, exceptions, abstract classes, and SPL. The application of these things makes Zend framework highly modular and flexible. In addition, Zend framework is expected to become an outstanding enterprise application development framework because it strictly complies with the principles of "interface-specific programming" and "Single Object Responsibility. the official product comes with a lot of libraries. The framework itself uses a lot of design patterns to write, the architecture is very elegant, and the execution efficiency is moderate; MVC design, relatively simple, with routing functions, the configuration file is powerful (it can process XML and php ini), and various libraries are powerful. It is the most comprehensive function in all PHP frameworks, including not only a framework, it is also a big-class library (replacing pear), which is its main characteristic. It can intuitively support model layers other than database operations (better than codeigniter and CakePHP ), in addition, it is easy to use the loader function to load other new classes. The cache function is very powerful and supports both the front-end cache and the back-end cache, the backend cache supports memcache, APC, SQLite, files, and other methods. The database has powerful operation functions and supports various drivers (adapters ). comprehensive documentation, in ChinaCommunityVery mature, and many Web 2.0 websites are currently in use, with medium learning costs.

Disadvantages:

The MVC function is relatively weak, and the view layer is simple to implement (the same as not implemented), so it cannot control the front-end page very effectively. there is no automated script. To create an application, including the entry file, you must manually create it. The entry cost is high. for simple and small projects, Zend framework does not improve development efficiency. On the contrary, because a large number of new features of object-oriented design and PhP5 are applied in the framework, they put forward higher requirements for developers and indirectly increase project development costs. For large projects and enterprise applications, Zend framework is a good foundation. However, as a very mature large PHP framework, some effort is needed.

Rating:

As an official framework, Zend Framework's ambition is foreseeable. It wants to squeeze out other frameworks and encapsulate many powerful class libraries to provide one-stop Framework Services, in addition, their development teams are very powerful and fully capable of developing powerful products. Therefore, we can basically determine that Zend framework has a promising future. If they spend more time improving the framework. Similarly, the Zend framework architecture itself is relatively elegant. It indicates that Zend has many experts and its design concepts are advanced. Although some functions are not complete enough, such as the view layer, automated scripts and so on, all of which depend on future upgrades. In general, Zend framework is the most promising framework. Of course, you have to invest in your project to use it.

CakePHP

Advantages:

CakePHP is the most similar to the ROR framework, including the design method and the active record mode for database operations. The design level is very elegant and there is no redundant library. All functions are pure frameworks, the execution efficiency is good; hasone and hasone at the database layer are very powerful, suitable for complex business processing, routing and configuration functions are good, and scaffold is very powerful, suitable for medium-sized applications. It has basically implemented every layer of MVC and has the function of Automatically operating command line scripts. the documentation is comprehensive and has been successfully promoted in China. Most of them know CakePHP, and the learning cost is moderate.

Disadvantages:

The most serious problem with CakePHP is to regard the model as a database-layer operation, which seriously affects the operation capability other than the database. the cache function of CakePHP is slightly weak, and the configuration function is slightly weak. CakePHP is not suitable for large applications and is only suitable for medium-sized applications. For small applications, the learning cost is slightly higher.

Rating:

In general, the CakePHP framework represents an important time and representative of the PHP framework, and currently plays a very important role. Many self-written frameworks mimic the CakePHP method, cakePHP is a milestone product. CakePHP reveals ror's agile development method and regards database operations as the only model design idea. It is an excellent tool for developing fast applications and prototypes. Similarly, it is also worth choosing.

Codeigniter

Advantages:

Code igniter advocates the principle that "Simplicity is beauty. No fancy design patterns, no gorgeous object structures, everything is so simple. RowsCodeAnd a few lines of code can be output. It is a model of "greatest truths to simplicity. The configuration is simple. All configurations are configured using PHP scripts with high execution efficiency. It has the basic routing function and can perform a certain degree of routing. It has the Preliminary Layout function, can make a certain degree of interface appearance; database layer encapsulation is good, has the basic MVC function. quick and concise, with few codes, high execution performance, simple framework, easy to use, low learning costs, and detailed documentation. It comes with a lot of simple and easy-to-use libraries and is suitable for small applications.

Disadvantages:

Its implementation is not ideal. The internal structure is too messy. Although easy to use, it lacks scalability. The model layer is simply understood as a database operation. The framework is slightly simpler, and can only meet the needs of small applications, slightly less meeting the needs of medium-sized applications.

Rating:

In general, it is worthwhile to use codeigniter to complete simple and fast applications. At the same time, it can construct a certain degree of layout to facilitate template reuse. The data operation layer is well encapsulated, in addition, codeigniter does not use many complicated design modes, and the execution performance and code readability are both good. The additional library is also good, concise and efficient.

Symfony

Advantages:

Symfony is the most powerful php framework I know, and I have been using it for a long time, but many functions have not been mined. It fully implements the MVC Layer 3 and encapsulates everything, including $Post, $Get data, exception handling, debugging, and data detection; including powerful caching functions, automatic class loading (this feature is great), and powerful language support; it has powerful view-layer operations and can contain multiple files in parts. It has powerful configuration functions and can control all frameworks andProgramThe running behavior is powerful enough to make people speechless. It can define various classes at will, and symfony can automatically load these classes and call them freely in the program; powerful multi-level project and Application Management: Project --> Application --> module --> action can meet the needs of multiple applications under a project, in addition, each layer can define its own class library, configuration file, and layout; very powerful command line operation functions, including creating projects, applications, modules, and cache refreshing. symfony is definitely the first choice for developing large and complex projects, because the use of symfony will greatly save development costs, and there will be no problems when many people collaborate, after defining the basic class at the project level, all modules can be reused, greatly reusing code.

Disadvantages:

The biggest problem with symfony is that it uses too many open-source projects with different styles to build a framework. Because mojavi and propel are both quite complex, the symfony structure is very complex and hard to understand and learn. The cache function cannot be controlled. Every development and debugging is always cached. You need to execute symfony CC and symfony RC to clear and recreate the cache. efficiency is not very high, especially when parsing templates and reading configuration files, it takes a lot of time. the learning cost is very high, and there are no mature communities and documents in China, even Chinese manuals. It takes a lot of time to master all functions.

Rating:

Symfony is definitely an enterprise-level framework. It is the only thing that seems to be able to compete with powerful frameworks in the Java field. Powerful things are naturally complicated to learn, but they are also helpful for project development, naturally, it is worthwhile to recommend complicated projects to use symfony for processing. Later maintenance costs are relatively low and the reusability is very strong. If symfony is used in a complex Internet project, you need to consider the database distribution issue. Therefore, you need to discard the database operation layer that comes with symfony and define it by yourself, of course, symfony supports constructing the model layer at will.

Thinkphp

Thinkphp quickly borrowed mature Java ideas, but some basic curd Association operations were incorrect in actual use. Based on PhP5, thinkphp makes full use of the features of PhP5. I like thinkphp's data verification and automatic filling. However, this also binds thinkphp and does not consider adding small functions such as automatic statistics fields.

Another feature of thinkphp is to automatically generate data, but this does not support association. Alas, thinkphp has excellent features and ideas, but has a very general application experience. Thinkphp documents are the most abundant, and the same is true. However, thinkphp documents and examples are too extensive. For example, table association only describes the definitions in the model, other curd operations are not mentioned.

Fleaphp

Fleaphp is an application framework developed using PHP (fully supporting PhP4 and PhP5). It provides necessary basic functions and auxiliary components for developers to create their own applications. It is mature, fast, and has rich functions. However, thinkphp is not as user-friendly as thinkphp in some details. Such as the URL function. In fleaphp, the first two parameters of the URL function are controllers and action names, while thinkphp is the opposite, because only the action name is entered. In addition, the arrangement of such parameters in database operations is not thinkphp user-friendly. Fleaphp is very powerful in data operations and can operate intermediate tables. Fleaphp has very few documents and examples, and has a high learning cost. But it's easy to get started. The fleaphp framework has a very small core, but with flexible configuration, it can combine various types of infrastructure. For simple script pages, fleaphp does not need to load the MVC mode, but only needs to provide business logic and database services for applications. For complex applications, fleaphp can complete various tasks, such as calling in MVC mode, access control, data verification, file upload, and image processing. Because of this outstanding customization and scalability, fleaphp is truly close to the goal of "meeting various needs from simple applications to enterprise development. Unlike many other frameworks, fleaphp is a framework fully refined in actual development. Fleaphp, as a fully-made framework, has completely Chinese documents and code annotations, and also focuses on the actual needs of domestic developers in terms of extended functions. Therefore, compared with various foreign frameworks, fleaphp is more likely to be accepted by domestic developers.

General evaluation:

The above several frameworks have their own characteristics and are all open-source projects, but the frameworks are not the same. codeingiter is generally suitable for small projects, and CakePHP and Zend framework are suitable for medium-sized projects, symfony is suitable for large heavyweight projects. When selecting a project, you must fully consider the customization and scalability of the framework, because each project cannot determine whether you will change as the demand changes.

relatively speaking, Zend framework and symfony have strong ability to cope with changes, especially the ability to customize the class at the model layer at will, which makes it very convenient to add their own business or data processing classes, I personally recommend the framework used in medium and large projects. Codeingiter and CakePHP can also play a major role in small and medium-sized projects, rapid development and prototyping, and are very suitable for the development of target and unclear prototype projects. The thinkphp framework is an excellent framework in China. It has powerful functions and is easy to learn. Its Flexible Design adheres to the simple concept. Use fleaphp if you focus too much on efficiency.

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.