Comparison of advantages and disadvantages of mainstream PHP frameworks _ php instances

Source: Internet
Author: User
Tags codeigniter zend framework
This article mainly introduces the comparative analysis of the advantages and disadvantages of several popular PHP frameworks this year. It is very simple and practical. If you need it, refer to it. 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.

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