Comparison of mainstream PHP frameworks abroad-CodeIgniter, CakePHP, ZendFramework, and Symfony. Recently, I have simply used several mainstream foreign PHP frameworks (excluding domestic frameworks) that are currently used in China. I have a rough idea about these frameworks. I would like to share them with you briefly, I have recently used several mainstream foreign PHP frameworks (excluding domestic frameworks) that are currently used in China. I have a rough idea about these frameworks, let's briefly share some ideas about which frameworks can be used as a reference.
The main reference frameworks include: CodeIgniter, CakePHP, ZendFramework, and Symfony.
Note: I have not used many frameworks seriously. I just tried it for a while. many ideas may be immature or incorrect. please correct me and grow together.
Chinese site: http://codeigniter.org.cn
Chinese Manual: http://codeigniter.org.cn/user_guide
Video tutorial: http://codeigniter.org.cn/tutorials
Test version: CodeIgniter_1.6.1
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 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.
1. a simple understanding of the Model layer as a database operation
2. the framework is slightly simpler and can only meet the needs of small applications.
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.
Chinese Manual: http://www.1x3x.net/cakephp
Video tutorial: http://search.you.video.sina.com.cn/s? Key = cakephp
Test version: cake_220.127.116.1105
1. 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, 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.
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.
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.
Chinese Manual: http://www.phpeye.com/zf
Video tutorial: http://framework.zend.com/docs/screencasts
Test version: ZendFramework-1.5.0
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 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.
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 large-scale application Framework. However, as a very mature large PHP Framework, some efforts are required.
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 Framework. of course, you have to invest in your project to use it.
Chinese site: http://symfony-project.cn
Authoritative Guide to http://www.symfony-project.org/book
Learning reference: http://sf.thecodecentral.com
Test version: symfony-1.0.13
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
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.
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.
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 model-layer classes 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 best way to understand a framework is to use it. The best way to learn it is to watch videos. :-)
Wise, wise, and wise. when selecting a framework for a project, carefully examine the needs of the project and future changes, and then select a suitable framework, a reasonable balance between the project development speed and the maintainability in the later stage. of course, it may be better to write a framework by yourself. :-)
I have commented on several frameworks in general. I don't think many things have come up with ideas. let's just look at them. I also welcome your comments!
Explain (excluding the domestic framework) has an intuitive feeling on these frameworks. let's share it with you briefly...