Comparison and analysis of the advantages and disadvantages of mainstream PHP frameworks; comparison and analysis of the advantages and disadvantages of frameworks _ PHP Tutorial

Source: Internet
Author: User
Comparison and analysis of the advantages and disadvantages of mainstream PHP frameworks, and comparison and analysis of the advantages and disadvantages of frameworks. Comparison and analysis of the advantages and disadvantages of mainstream PHP frameworks. Comparison and analysis of the advantages and disadvantages of the frameworks PHP is a popular open-source server-side scripting language at home and abroad. It can be used to compare and analyze the advantages and disadvantages of mainstream PHP frameworks in large and small projects, and compare and analyze the advantages and disadvantages of frameworks.

PHP is a popular open-source server-side scripting language at home and abroad. It can meet the development needs of large, medium and small projects. We will introduce several mainstream PHP frameworks and their advantages and disadvantages in this article and share them with you as a reference.

The main reference PHP frameworks include: CodeIgniter, CakePHP, ZendFramework, and Symfony. I have not used many frameworks seriously, but I just tried it for a while. many ideas may be immature or incorrect. please correct me and grow together.

  CodeIgniter

Advantages:

1. 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, ability to make a certain degree of interface appearance; database layer encapsulation is good, with basic MVC functions

2. quick and concise, with few codes, high execution performance, simple PHP framework, easy to use, low learning costs, and detailed documentation. it comes with many simple and easy-to-use libraries and is suitable for small applications.

Disadvantages:

1. a simple understanding of the Model layer as a database operation

2. the PHP framework is slightly simpler. it can only meet the needs of small applications and slightly less meet 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.

  CakePHP

Advantages:

1. cakePHP is the PHP framework most similar to RoR, 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, execution efficiency is good; hasOne and hasOne at the database layer have powerful functions and are suitable for complex business processing; routing and configuration functions are good; scaffold is powerful; suitable for medium-sized applications; basically implemented through each layer of MVC; with the ability to automatically operate command line scripts;

2. the document is comprehensive and has been successfully promoted in China. most of them know CakePHP, and the learning cost is moderate.

Disadvantages:

1. a very serious problem with CakePHP is to regard the Model as a database-layer operation, which seriously affects the operation capability other than the database.

2. 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 a very important era 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.

  Zend Framework

Advantages:

1. 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. in MVC design, it is concise and has 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 PHP 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, and files. the database has powerful operations and supports various drivers (adapters)

2. the documentation is comprehensive and mature in domestic communities. Currently, many 2.0 Web websites are in use, and the learning cost is moderate.

Disadvantages:

1. 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.

2. there is no automated script. to create an application, including the entry file, all the files must be built manually. the entry cost is high.

3. Zend Framework, as a medium-sized application Framework, has little problem and can barely serve as a PHP Framework for large applications. However, as a very mature large PHP Framework, some efforts are required.

Rating:

As an official Framework, Zend Framework's ambition is foreseeable. it also encapsulates 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 PHP Framework. of course, it is no problem to invest in your project.

  Symfony

Advantages

1. 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. It includes powerful cache functions and automatically loads Class (this function is great ), powerful i18n national support; powerful view-layer operations that can contain a single file in a fraction; very powerful configuration functions, yml configuration can control all the frameworks and program running behaviors, strong enough to make people speechless; can define various classes at will, and symfony can automatically load these classes, can be freely called 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;

2. 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, any module can be reused, greatly reusing code

Disadvantages:

1. the database operation model adopts the heavyweight propel and creole, but they have been moved to addon in the version I tested. they are available but not needed.

2. 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;

3. the efficiency is not very high. it takes a lot of time to parse the template and read the configuration file;

4. 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 PHP 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, however, it is also helpful for project development. Naturally, it is recommended that complicated projects use Symfony for processing. it is worthwhile. 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.

Summary

The above PHP frameworks have their own characteristics and are all open-source projects. However, the frameworks are different for different projects. CodeIngiter is generally more suitable for small projects, and CakePHP and Zend Framework are more 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 model-layer classes at will, which makes it very convenient to add their own business or data processing classes, I personally recommend using the PHP framework in large and medium-sized 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.

PHP is a popular open-source server-side scripting language at home and abroad. Able to adapt to large and small projects...

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.