Author: heiyeluren
Blog: http://blog.csdn.net/heiyeshuwu
Time: 2008-5-5
Recently, I have simply used several mainstream foreign PHP frameworks (excluding domestic frameworks) that are currently used in China. I have an intuitive feeling about these frameworks. I would like to share briefly, which ones should be used when selecting frameworks? Use it as a reference.
The main reference frameworks include: CodeIgniter, CakePHP, ZendFramework, and Symfony.
Note: 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】
Official website: http://codeigniter.com
Chinese website: 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
Advantages:
1. The configuration is simple, all configurations are configured using PHP scripts, and the execution efficiency is high; it has basic routing functions and can perform routing to a certain extent; it has preliminary Layout functions and can create a certain level of interface appearance; the database layer is well encapsulated , with basic MVC functionality
2. Fast and concise, not much code, high execution performance, simple framework, easy to use, low learning cost, detailed documentation; it comes with many simple and easy-to-use libraries, and the framework is suitable for small applications
. Disadvantages:
1. Simply understand the Model layer as database operations
2. The framework is slightly simple and can only meet the needs of small applications, but is slightly less able to meet the needs of medium-sized applications
. Evaluation:
Generally speaking, 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. Both performance and code readability are good. As for the additional library, it is also pretty good, simple and efficient.
【CakePHP】
Official website: http://www.cakephp.org
Chinese manual: http://www.1x3x.net/cakephp
Video tutorial: http://search.you.video.sina.com.cn/s?key=cakephp
Test version: cake_1.1.19.6305
Advantages:
1. CakePHP is the framework most similar to RoR, including the design method and the Active Record method of database operation; the design level is very elegant, it does not come with extra libraries, all functions are pure frameworks, and the execution efficiency is not bad; the database layer The hasOne and hasMany functions are very powerful and suitable for complex business processing; the routing function and configuration function are not bad; the automatic scaffolding (scaffold) is very powerful; suitable for medium-sized applications; basically implemented every layer of MVC; and has automatic operation command line Script function;
2. The documentation is relatively complete and has been successfully promoted in China. Most people know CakePHP. The learning cost is medium.
Disadvantages:
1. A very serious problem with CakePHP is that it understands Model as a database layer operation, which seriously affects its ability to operate other than the database.
2. CakePHP’s cache function is slightly weak, and its configuration function is slightly weak; CakePHP is not suitable for large-scale applications, but only for medium-sized applications. The learning cost is slightly higher for small-scale applications. Comments
:
Generally speaking, 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 imitate the CakePHP method, which is a landmark product; CakePHP reveals the RoR Agile development methods and the design philosophy of considering database operations as the only model are excellent tools for developing rapid applications and prototypes; similarly, it is also worth choosing as a development framework for Web 2.0 websites.
【Zend Framework】
Official website: http://framework.zend.com
Chinese manual: http://www.phpeye.com/zf
Video tutorial: http://framework.zend.com/docs/screencasts
Test version: ZendFramework-1.5.0
Advantages:
1. Officially produced, it comes with a lot of libraries. The framework itself is written using many design patterns. The architecture is very elegant and the execution efficiency is medium. The MVC design is relatively simple, has routing functions, and the configuration file is relatively powerful (can handle XML and php INI), various libraries are very powerful and have the most comprehensive functions among all PHP frameworks, including that it is not only a framework, but also a large class library (replacing PEAR). This is its main feature; it can Intuitively supports the Model layer in addition to database operations (stronger than CodeIgniter and CakePHP), and can easily use the Loader function to load other newly added Classes; the Cache function is very powerful, and is supported from the front-end Cache to the back-end Cache. The terminal Cache supports Memcache, APC, SQLite, files, etc.; the database operation function is very powerful and supports various drivers (adapters)
2. The documentation is very complete, the domestic community is very mature, 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 (just like it is not implemented), and it cannot control the front-end page very powerfully.
2. There is no automated script. To create an application, including the entry file, you must build it manually. The 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. However, as a very mature large-scale PHP framework, it still needs some efforts
to evaluate:
As an officially produced 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. Moreover, their development team is very powerful and fully capable. With the ability to develop very powerful products, 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】
Official website: http://www.symfony-project.org
Chinese website: http://symfony-project.cn
The Definitive Guide: http://www.symfony-project.org/book
Learning reference: http://sf.thecodecentral.com
Test version: symfony-1.0.13
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 discovered yet; it completely implements the three layers of MVC and encapsulates everything, including $_POST, $_GET Data, exception handling, debugging function, data detection; includes powerful caching function, automatic loading of Class (this function is very cool), powerful i18n nationalization support; has very powerful view layer operation, and can contain multiple files in a piecemeal manner ; Very powerful configuration function. Using yml configuration can control all frameworks and program running behaviors, which is so powerful that it makes people speechless; you can define various classes of your own at will, and symfony can automatically load (auto load) these classes, which can be used in Can be called 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, layout; very powerful command line operation functions, including building projects, building applications, building modules, refreshing cache, etc.;
2. Symfony is definitely the first choice for developing large and complex projects, because using Symfony will greatly save development costs, and there will be no problems when multiple people collaborate. After the basic Class is defined at the Project level, any module can be reused.
greatly reusing code
:
1. The database operation model uses heavyweight prop and creole, but in the version I tested, they have been moved to addon. They can be used or not.
2. The cache function cannot be controlled. The cache is always cached every time during development and debugging. You need to execute symfony cc and 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, not even a Chinese manual. Accordingly, it takes a lot of time to master all the functions and
evaluate:
Symfony is definitely an enterprise-level framework, the only thing that can seemingly compete with the powerful frameworks in the Java field. Powerful things are naturally complicated to learn, but they are also helpful for project development. Naturally, it is recommended to use Symfony for complex projects. I think it is worth it. The maintenance cost in the later stage 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.
[General Comment]
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 and heavyweight projects. When selecting projects, you must fully consider the customizability and scalability of the framework, because each project cannot determine whether you will make changes as your needs change.
Relatively speaking, Zend Framework and Symfony have a strong ability to cope with changes, especially the Classes in the model layer that can be customized at will, making it very convenient to add your own business or data processing classes. I personally recommend these frameworks for use in medium and large projects. 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. The best way to understand a framework is to use it, and the best way to learn it is to watch videos. :-)
Benevolent people have different opinions, and wise people have different opinions. When selecting a framework for a project, please carefully examine the project's needs and future changes, and then choose an appropriate framework to achieve a reasonable balance between project development speed and later maintainability. Of course , maybe it is more suitable to write a framework yourself. :-)
I have made a general evaluation of several frameworks. I guess a lot of things are not on point, so I’ll just leave it at that. Comments and corrections are also welcome!