Comparative analysis of the advantages and disadvantages of the mainstream PHP framework _php example

Source: Internet
Author: User
Tags exception handling php framework php script codeigniter zend zend framework

PHP is a popular open source server-side script development language both at home and abroad. Able to adapt to the development needs of large and medium sized projects. In this article we will introduce several mainstream PHP framework and its related advantages and disadvantages of the comparison, as a reference to share with friends.

The main reference PHP framework includes: CodeIgniter, cake, zendframework, Symfony. I have no serious use of many frameworks, just a simple trial, may be a lot of views are immature or wrong, please correct me, grow up together.

  CodeIgniter

Advantages:

1. Simple configuration, all the configuration using PHP script configuration, the implementation of high efficiency, with the basic routing function, can carry out a certain degree of routing; With the initial layout function, can make a certain degree of interface appearance; The database layer is packaged well and has basic MVC functionality

2. Fast and concise, code is not much, high performance, PHP framework simple, easy to use, low learning costs, document detail; With a lot of simple and easy to use library, the framework for small applications

Disadvantages:

1. The model layer as a simple understanding of database operations

2. PHP Framework is slightly simpler, only to meet small applications, slightly less able to meet the needs of medium-sized applications

Evaluation:

Overall, the use of CodeIgniter to complete a simple and rapid application is still worthwhile, at the same time to construct a certain degree of layout, easy to reuse the template, the data operation layer is very good encapsulation, and codeigniter not used many too complex design patterns, Execution performance and code readability are good. As for the additional library is also good, simple and efficient.

  Cakephp

Advantages:

1. Cake is the most similar to the ROR PHP framework, including the design method, database operation of the active record way; the design level is elegant, there is no extra library, all functions are pure frame, execution efficiency is good; database layer Hasone, Hasmany function is very powerful, for complex business processing is more appropriate, routing function, configuration function is not bad; automatic construction of scaffolding (scaffold) is very powerful, suitable for medium-sized applications, basically implemented every layer of MVC, with automatic command line script function;

2. Document comparison, in the domestic promotion of the relatively successful, most of them know cake, learning cost medium

Disadvantages:

1. Cake is very serious problem is to understand the model as a database layer operation, seriously affecting the ability to operate in addition to the database

2. Cake's cache function is slightly weak, the configuration function is slightly weak; cake is not suitable for large applications, only suitable for medium-sized applications, small application is a little higher learning costs

Evaluation:

In general, the cake frame represents an important era and representative of the PHP framework, and currently plays a very important role, many of their own written frameworks imitate Cake's way, is a milestone product Cake discloses the Ror Agile development Method and the idea that database operation is the only model, as a great tool for developing rapid applications and prototypes, and also for the development framework of Web2.0 Web sites, which is also worth choosing.

  Zend Framework

Advantages:

1. The official production, with a very large number of library, the framework itself using a lot of design patterns to write, the architecture is elegant, the implementation of the efficiency of the medium; MVC design, relatively concise, with the routing function, the configuration file is more powerful (able to handle XML and PHP INI), the various library is very is the most comprehensive of all PHP frameworks, including it is not only a PHP framework, but also a large class library (instead of pear), which is its main feature; able to visually support the model layer (more than CodeIgniter and cake) in addition to database operations, and can easily use the loader function to load other new Class;cache function is very powerful, from the front-end cache to the back-end cache support, back-end cache support Memcache, APC, SQLite, file and so on; Database operation is very powerful, supports a variety of drives (adapters)

2. The document is very complete, in the domestic community is very mature, and currently many Web 2.0 Web sites in use, learning costs medium

Disadvantages:

1. Mvc function is relatively weak, the view layer is simple to implement (as not implemented), not very powerful control of the front page

2. No automated scripts to create an application, including portal files, all must be built by themselves, the cost of entry is high

3. The Zend framework as a medium-scale application framework has little to do with the PHP framework for large applications, but as a very mature large PHP framework, some effort is needed

Evaluation:

As a government-produced framework, the Zend framework's ambitions are predictable, trying to squeeze other frameworks, while encapsulating many powerful class libraries, providing a one-stop framework service, and their development teams are powerful enough to be able to develop powerful products. So the basic certainty is that the Zend framework is promising, if it takes more time to perfect the framework. Similarly, the Zend framework itself is also more elegant, indicating that the official Zend is a lot of experts, the design concept is more advanced, although some of the functions to achieve the imperfect, such as the view layer, automated scripts, etc., these are dependent on future upgrades. In general, the Zend Framework is the most anticipated PHP framework, and of course, your current use in your project is completely fine.

  Symfony

Advantages

1. Symfony is one of the most powerful PHP frameworks I know, and I use it for a long time, but a lot of features haven't been dug out; it fully implements the MVC three layer, encapsulates everything, including $_post,$_get data, exception handling, debugging, data detection ; Contains powerful caching capabilities, automatic load class (This feature is very cool), powerful i18n support, with a very powerful view layer operations, can be fragmented containing a single number of files, very powerful configuration, using YML configuration can control all framework and program operation behavior, powerful to make people silent , can easily define various classes of their own, and symfony can automatically load (auto load) These classes, can be arbitrarily invoked in the program, including powerful multi-level project and application Management: Project--> application--> Module--> action, which can meet the needs of multiple applications under a project, and each layer can define its own class library, configuration files, layout, very powerful command-line operations, including building projects, building applications, building modules, refreshing caches, and so on;

2. Symfony is definitely the first choice to develop large and complex projects, because the use of symfony, will greatly reduce the cost of development, and many people collaborate, there will be no problems, after the project level to define a good foundation class, any module can be reused, greatly reusing code

Disadvantages:

1. The database operation model uses the heavyweight propel and Creole, but it has been moved to the addon in the version of my test and is not available

2. Cache function is unable to control, each development debugging always cache, need to perform symfony cc, Symfony RC to clear and rebuild cache;

3. The efficiency is not very high, especially the process of parsing the template and reading the configuration file, it takes a lot of time;

4. The high cost of learning, and there is no mature community and documents, even the Chinese manual is not, the corresponding to master all functions, it will take more time to spend

Evaluation:

Symfony is definitely an enterprise-class PHP framework, the only thing that seems to be able to compete with the strong framework of the Java domain; tough things, natural learning complex, but the corresponding to the project development is also more helpful, nature is to recommend complex projects using Symfony to deal with, think it is worthwhile, Later maintenance cost is lower, the reusability is very strong. The corresponding if the use of symfony should be more complex Internet projects, then the corresponding need to consider the issue of database distribution, then we have to discard the symfony of the database operating layer, the need to define their own, of course, symfony support arbitrary construction model layer.

Summarize

The above several PHP frameworks, each have characteristics, and are open source projects, but the framework for the project is not the same, generally speaking codeingiter more suitable for small projects, cake and Zend framework is more suitable for medium-sized projects, Symfony more suitable for large heavyweight projects, When choosing a project, take full account of the customization and extensibility of the framework, because each project is unsure whether you will change as the requirements change.

Relatively speaking, the Zend framework and Symfony ability to cope with change, especially to be able to customize the model layer of class, can be very convenient to increase their business or data processing classes, I am a personal comparison recommended in large projects in the PHP framework used.

Codeingiter and cake can also play a major role in small and medium sized projects, rapid development and prototyping, and are ideal for the development of prototype projects that are not clearly targeted.

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.