Comparative evaluation of foreign mainstream PHP frameworks_PHP tutorial

WBOY
Release: 2016-07-15 13:25:44
Original
930 people have browsed it

Recently, I have simply used several mainstream foreign PHP frameworks (excluding domestic frameworks) that are currently used in China. I generally have an intuitive feeling about these frameworks. I would like to share briefly what to do. When selecting a frame, use it as a reference.

Main reference frameworks include: CodeIgniter, CakePHP, ZendFramework, and Symfony. I have not used many frameworks seriously, I just tried them briefly. Many of my opinions may be immature or wrong. Please correct me and let us grow together.

CodeIgniter

Advantages:

1. Simple configuration, all configurations are configured using PHP scripts, with high execution efficiency; it has basic routing functions , capable of routing to a certain extent; has preliminary Layout function and can create a certain level of interface appearance; the database layer is well encapsulated and has basic MVC functions

2. Fast and concise, not much code, good execution performance High, the framework is simple, easy to use, low learning cost, detailed documentation; it comes with a lot of simple and easy-to-use libraries, the framework is suitable for small applications

Disadvantages:

1. Simple model layer Understood as database operations

2. The framework is slightly simple and can only meet the needs of small-scale applications, and is slightly less able to meet the needs of medium-sized applications

Evaluation:

In general, take 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 the reuse of templates. The data operation layer is well encapsulated, and CodeIgniter does not use many too complex design patterns, which improves execution performance and code readability. Sexually good. As for the additional library, it is not bad, simple and efficient.

CakePHP

Advantages:

1. CakePHP is the framework most similar to RoR, including design method and Active Record method of database operation; design The layer is very elegant, there is no extra library, all functions are pure frameworks, and the execution efficiency is pretty good; the hasOne and hasMany functions of the database layer are very powerful and suitable for complex business processing; the routing function and configuration function are not bad; The automatic construction of scaffolding (scaffold) is very powerful; suitable for medium-sized applications; it has basically implemented every layer of MVC; it has the function of automatically operating command line scripts;

2. The documentation is relatively complete and has been successfully promoted in China. Everyone knows about CakePHP, and the learning cost is medium

Disadvantages:

1. A very serious problem with CakePHP is that it understands the Model as a database layer operation, which seriously affects the ability to operate 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-scale applications, only suitable for medium-sized applications. The learning cost is slightly higher for small applications

Evaluation:

Generally speaking, the CakePHP framework represents a very important era and representative of the PHP framework, and it currently plays a very important role. Many self-written frameworks imitate the CakePHP method, which is a landmark product. ; CakePHP reveals RoR's agile development method and the design idea of ​​considering database operations as the only model. It is an excellent tool for developing rapid applications and prototypes; similarly, it is also worth choosing as a development framework for Web2.0 websites. .

Zend Framework

Advantages:

1. Official product, comes with a lot of libraries, and the framework itself is written using many design patterns , the architecture is very elegant, the execution efficiency is medium; in the MVC design, it is relatively simple, has routing functions, the configuration file is relatively powerful (can handle XML and php INI), various libraries are very powerful, and it is the most comprehensive function among all PHP frameworks , including that it is not only a framework, but also a large class library (replacing PEAR), which is its main feature; it can intuitively support the Model layer in addition to database operations (stronger than CodeIgniter and CakePHP), and can be very Easily use the Loader function to load other newly added Classes; the Cache function is very powerful, supporting both front-end Cache and back-end Cache. The back-end Cache supports Memcache, APC, SQLite, files, etc.; the database operation function is very powerful and supports various methods. Driver (adapter)

2. The documentation is very complete, it is very mature in the domestic community, and is currently used by many Web 2.0 websites, and the learning cost is medium

Disadvantages:

1. The MVC function is relatively weak, the View layer is simply implemented (the same as if it is not implemented), and it cannot powerfully control the front-end page

2. There is no automated script. To create an application, including the entry file, everything must be done manually. Construction, entry cost is high

3. Zend Framework is not a big problem as a medium-sized application framework, and it can barely be used as a framework for large-scale applications, but as a very mature large-scale PHP framework, it still needs some effort

Rating:

As an official framework, Zend Framework’s ambitions are foreseeable. It wants to crowd out other frameworks and at the same time encapsulate many powerful class libraries to provide one-stop framework services, and their development team is very strong. It is fully capable of developing very powerful products, so it is basically certain that Zend Framework has a bright future, if more time is spent to improve the framework. Similarly, the Zend Framework architecture itself is relatively elegant, which shows that Zend officially has many experts and is relatively advanced in design concepts. Although some functions are not fully implemented, such as the View layer, automation scripts, etc., these all depend on the future. upgrade. Generally speaking, Zend Framework is the most anticipated framework. Of course, there is no problem if you want to use it in your projects now.

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 yet been discovered; it fully implements the three layers of MVC and encapsulates everything, including $_POST, $_GET data, exception handling, debugging functions, and data detection; it includes powerful caching functions and automatic loading of Classes (this function is very Cool), powerful i18n nationalization support; very powerful view layer operation, able to contain multiple files piecemeal; very powerful configuration function, using yml configuration to control all frameworks and program running behaviors, so powerful that it makes people speechless ; You can define various classes of your own at will, and symfony can automatically load these classes and call them at will in the program; Includes powerful multi-level project and application management: Project --> Application --> ; Module --> Action, which can meet the needs of multiple applications under one project, and each layer can define its own class library, configuration file, and layout; very powerful command line operation functions, including creating projects, creating applications, and creating Modules, refresh cache, etc.;

2. Symfony is definitely the first choice for developing large and complex projects, because using Symfony will greatly save development costs, and when multiple people collaborate, there will be no problems. In Project After the basic Class is defined at the level, any module can be reused, greatly reusing code

Disadvantages:

1. The database operation model uses heavyweight prop and creole, but in my test They have been moved to the addon in the version. They can be used or not

2. The cache function cannot be controlled. Every time development and debugging are always cached, you 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, which takes a lot of time;

4. The learning cost is very high, and there is no mature community and documentation in China. There is no Chinese manual, and accordingly it takes a lot of time to master all the functions

Evaluation:

Symfony is definitely an enterprise-level framework, the only one that can seemingly compete with other powerful frameworks in the Java field Something to contend with; a powerful thing that is naturally complicated to learn, but it is also helpful for project development. Naturally, it is recommended to use Symfony to handle complex projects. I think it is worth it. The later maintenance cost is relatively low and the reusability is very strong. . Correspondingly, if you use Symfony for more complex Internet projects, you must consider the issue of database distribution. Then you need to abandon the database operation layer that comes with Symfony and define it yourself. Of course, Symfony supports arbitrary Construct the model layer.

Summary

The above frameworks have their own characteristics, and they are all open source projects. However, the projects targeted by the frameworks are different. Generally speaking, CodeIngiter is more suitable for small projects. , CakePHP and Zend Framework are more suitable for medium-sized projects, and Symfony is more suitable for large-scale heavyweight projects. When selecting projects, you must fully consider the customizability and scalability of the framework, because each project cannot determine whether you will adapt to the needs. changes.

Relatively speaking, Zend Framework and Symfony have a strong ability to cope with changes, especially the ability to customize the Class of the model layer at will, which is very convenient for adding your own business or data processing classes. I personally recommend it for medium and large companies. The framework used in the project.

CodeIngiter and CakePHP can also play a significant role in small and medium-sized projects, rapid development and prototype construction, and are very suitable for the development of prototype projects with unclear goals.

Of course, maybe it is more suitable to write a framework yourself.

I have made a general evaluation of several frameworks. I guess many things are not on point, so I’ll just leave it at that. Opinions and corrections are also welcome!


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446670.htmlTechArticleRecently, I have simply used several mainstream foreign PHP frameworks that are currently used in China (excluding domestic frameworks ), I have a general intuitive feeling about these frameworks, and I would like to share them briefly...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template