Advantages and disadvantages of the seven main frameworks commonly used in PHP

Source: Internet
Author: User
Tags php framework codeigniter yii zend framework
Body Content

All along, phper the most discussed is the advantages and disadvantages of PHP frameworks, online information is relatively fragmented, now several mainstream framework collection, which I just used Yii2, Laravel, YAF, thinkphp these four kinds of framework, So most of the evaluation of the various frameworks comes from the online material, if the question, please point out in the comments, common progress

First, thinkphp

Thinkphp (FCS) is a lightweight, medium-sized framework that is ported from the struts structure of Java to the Chinese PHP development framework. It uses object-oriented development structure and MVC pattern, and simulates the implementation of Struts tag library, all aspects are more humane, familiar with the Java EE developers relatively easy to use, suitable for beginners PHP framework. Thinkphp's mission is to simplify development, improve efficiency and ease of expansion, and its support for databases has included MySQL, MSSQL, Sqlite, Pgsql, Oracle, and PDO. Thinkphp has a wealth of documentation and examples, the framework is more compatible, but its function is limited, so it is more suitable for small and medium-sized project development.

Advantages

1. With a proven Java mindset

2. Easy to get started, rich in Chinese documents, low learning cost, high community activity

3. The framework has strong compatibility, PHP4 and PHP5 are fully compatible, fully support UTF8 and so on.

4. Suitable for small and medium project development

5. Introduction of composer Package management tool from thinkphp3.2.2

Disadvantages

1. Support for Ajax is not very good;

2. The directory structure is chaotic, which is nearly as close to other framework directory structures;

3. Easy to get started, but more difficult to learn.

Second, Yii

Yii is a high-performance, component-based PHP framework for developing large Web applications. Yii is written in strict OOP, with well-established library references and comprehensive tutorials. From mvc,dao/activerecord,widgets,caching, hierarchical Rbac,web services, to theming, i18n and l10n,yii provide almost everything you need for today's Web 2.0 application development. In fact, Yii is one of the most efficient PHP frameworks.

Advantages

1. Pure OOP

2. For large-scale Web applications

3. Easy to use model

4. The development speed is fast, the operation speed is also fast. Excellent performance and rich functionality

5. Use the command-line tool.

6. Support Composer Package management tool

Disadvantages:

1. Less guidance and consideration of the model layer

2. Fewer document instances

3. Too many English

4. Require PHP technology proficiency, OOP programming proficiency!

5.View is not an ideal view, the ideal view may be just HTML code and will not involve PHP code.

Third, Laravel

Advantages

1.laravel design concept is very advanced, ideal for application of various development modes TDD, DDD and BDD

2. Support Composer Package management tool

3. A collection of PHP's new features, as well as a variety of design patterns, Ioc containers, dependency injection, and more.

Disadvantages

1. The component-based framework makes it more bloated

Iv. CodeIgniter

Advantages:

1.Code igniter The principle of "simplicity is beauty". There is no fancy design pattern, no ornate object structure, everything is so simple. A few lines of code can start running, and a few lines of code can be used to output it. It is a model of "Boulevard to Jane".

2. Simple configuration, all the configuration using PHP script configuration, the execution of high efficiency;

3. Has the basic routing function, can carry on a certain degree of routing;

4. Have the initial layout function, can make a certain degree of interface appearance;

5. Database layer encapsulation is good, with basic MVC functionality.

6. Quick and concise, the code is not many, the execution performance is high,

7. Simple frame, easy to get started, low learning cost, document details;

8. With a lot of easy to use library, the framework for small applications.

Disadvantages:

1. The realization of itself is not ideal.

2. The internal structure is too confusing, albeit simple to use, but lacks the capacity to expand.

3. Simply understand the model layer as a database operation.

4. The frame is simple enough to meet small applications and is slightly less able to meet the needs of midsize applications.

Evaluation:

Overall, take CodeIgniter to complete the simple and fast application is worth, at the same time can construct a certain degree of layout, easy to reuse the template, the data operation layer is good encapsulation, and codeigniter not use many too complex design patterns, Good execution performance and code readability. As for the additional library is also good, concise and efficient.

V. Zend Framework

Advantages:

1. The new object-oriented features in PHP5 are applied extensively: interfaces, exceptions, abstract classes, SPL, and so on. The application of these things gives the Zend framework a high degree of modularity and flexibility

2. Strictly follow the principles of "Programming for Interfaces" and "single object Responsibility"

3. The official production, with a very large library, the framework itself using a lot of design patterns to write, architecture is very elegant, efficient implementation of the medium

4.MVC design, relatively concise

5. Have the routing function, the configuration file is more powerful (can handle XML and PHP INI)

6. Ability to intuitively support the model layer (stronger than CodeIgniter and CakePHP) in addition to the database operation, and can easily use the loader function to load other newly added class

7.Cache is powerful, from the front-end cache to the back-end cache support, back-end cache support Memcache, APC, SQLite, files and so on

8. Database operation function is very powerful, support various drivers (adapters)

9. Documentation is complete, in the domestic community is very mature

Disadvantages:

The 1.MVC function is relatively weak, and the view layer is simple to implement (as with no implementation), it is not very powerful to control the front page.

2. No automation script, create an application, including the portal file, all must be built by hand, the cost of entry is high

3. For simple and small projects, but because of the application of a large number of object-oriented design in the framework, the developers put forward higher requirements, indirectly increase the project development costs

Evaluation:

As an official framework, the ambitions of the Zend framework are predictable, to squeeze out other frameworks, to encapsulate many powerful libraries, to provide one-stop framework services, and their development teams to be strong enough to develop powerful products. So the basic certainty is that the Zend framework will be promising, if it takes more time to refine the framework. Similarly, the Zend framework architecture itself is more elegant, indicating that the Zend official is a lot of experts, the design concept is more advanced, although some of the features are not perfect, such as the view layer, automation scripts, and so on, these depend on the future upgrade

VI. CakePHP

Advantages:

1. Most similar to ROR framework, including design method, active record mode of database operation

2. The design level is elegant, no redundant library, all functions are purely framework, the implementation of the efficiency is good

3. Database layer HasOne, Hasmany function is very powerful, for complex business processing more appropriate

4. Routing function, difficult to configure the function

5. Built-in scaffolding (scaffold) is powerful for medium-sized applications

6. Basically implemented every layer of MVC

7. Command line script function with automatic operation

8. Document comparison, learning cost is moderate

Disadvantages:

1.CakePHP a very serious problem is to understand the model as a database-level operation, which seriously affects the ability to operate beyond the database.

2.cache function slightly weak

3. The configuration function is slightly too weak

4. Not suitable for large-scale applications, only suitable for medium-sized applications, small applications slightly higher learning costs.

Evaluation:

In general, the cakephp framework represents a very important era and representative of the PHP framework, and is now playing a very important role, many of their own framework has been modeled as a model of cakephp, is a milestone product CakePHP revealed that Ror's agile approach to development and the idea of using database operations as the only model was a great tool for developing rapid applications and prototypes, and that the development framework used to make Web2.0 websites was also worth choosing.

Seven, Symfony

Advantages:

1. Full implementation of MVC layer three

2. Encapsulates everything including $POST, $GET data, exception handling, debugging functions, data detection

3. Contains powerful caching features

4. Automatically load class, can be very arbitrary to define a variety of their own class

5. Powerful language support

6. Have a very powerful view layer operation, can be fragmented to contain a single number of files

7. Very powerful configuration function, using XML configuration to control all framework and program running behavior

8. Includes powerful multi-layered project and Application management: Project----application----------to meet the needs of multiple applications under one project, and each layer can define its own class library, configuration file, layout

9. Very powerful command-line operation functions, including building projects, building applications, building modules, refreshing caches, etc.

10.Symfony is definitely the first choice to develop large complex projects, because using Symfony, will greatly save development costs, and multi-person collaboration, there is no problem, after the project level is defined in the basic class, any module can be reused, greatly reuse code.

Disadvantages:

1. The biggest problem is the use of too many different styles of open source projects to combine into a framework

2. Because Mojavi and propel are inherently complex, the structure of symfony is complex and difficult to understand and learn

3. Cache function is not controlled, every development debugging always cache, need to execute Symfony cc,symfony RC to clear and rebuild cache

4. Efficiency is not very high, especially the process of parsing templates and reading configuration files, it takes a lot of time

5. Learning costs are high and there are no mature community and Chinese documents in the country

Evaluation:

Symfony is definitely an enterprise-class framework, the only thing that can seem to be able to contend with the strong framework of the Java field, strong things, natural learning complex, but corresponding to the development of the project is also helpful, nature is recommended complex project use Symfony to deal with, feel is worth, The later maintenance cost is lower, the reusability is very strong. Corresponding if the use of symfony should be more complex Internet projects, then the corresponding to consider the problem of database distribution, then you need to abandon the database operation layer Symfony, need to define their own, of course, symfony support arbitrary structure of the model layer

General comments

The above frameworks are unique and open source projects, but the framework is not the same for projects, generally speaking:

1. Small Project: Codeingiter

2. Medium-sized projects: CakePHP, Zend Framework, Laravel, thinkphp

3. Heavy-weight projects: Yii, Symfony, Laravel

The above division is not absolute, in the project selection, to fully consider the framework can be customized, extensibility, because each project cannot determine whether you will change with the needs of the changes

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.