Home > Backend Development > PHP Tutorial > Seven mainstream PHP frameworks, how many have you used?

Seven mainstream PHP frameworks, how many have you used?

醉折花枝作酒筹
Release: 2023-04-09 20:50:02
forward
19741 people have browsed it

In php, there are seven most commonly used frameworks, namely Yii2, Laravel, Yaf, Thinkphp, Code Igniter, Zend Framework and CakePHP. Today we will introduce them in detail.

Seven mainstream PHP frameworks, how many have you used?

1. ThinkPHP

ThinkPHP (FCS) is a lightweight medium-sized framework that is transplanted from Java’s Struts structure to Chinese PHP development framework. It uses object-oriented development structure and MVC mode, and simulates the implementation of Struts tag library. It is more user-friendly in all aspects. It is relatively easy for developers familiar with J2EE to get started, and it is suitable for beginners of PHP framework. ThinkPHP's purpose is to simplify development, improve efficiency, and be easy to expand. Its database support already includes support for MySQL, MSSQL, Sqlite, PgSQL, Oracle, and PDO. ThinkPHP has rich documentation and examples, and the framework has strong compatibility, but its functions are limited, so it is more suitable for the development of small and medium-sized projects.

Advantages

1. With the help of mature Java ideas

2. Easy to use, rich Chinese documentation; low learning cost, active community High

3. The framework has strong compatibility. PHP4 and PHP5 are fully compatible and fully supports UTF8, etc.

4. Suitable for the development of small and medium-sized projects

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

Disadvantages

1. The support for Ajax is not very good;

2. The directory structure is confusing, which is worse than that of other frameworks;

3. It is easy to get started, but difficult to learn in depth.

2. Yii

Yii is a high-performance component-based PHP framework for developing large-scale Web applications. Yii is written in strict OOP and has complete library references and comprehensive tutorials. From MVC, DAO/ActiveRecord, widgets, caching, hierarchical RBAC, web services, to theming, I18N and L10N, Yii provides almost everything needed for today's Web 2.0 application development. In fact, Yii is one of the most efficient PHP frameworks.

Advantages

1. Pure OOP

2. Used for large-scale web applications

3. The model is easy to use

4. The development speed is fast and the running speed is also fast. Excellent performance and rich features

5. Use command line tools.

6. Support composer package management tool

Disadvantages

1. Less guidance and consideration for the Model layer

2 .Few document examples

3.Too much English

4.Requires proficiency in PHP technology and proficiency in OOP programming!

5. View is not an ideal view. The ideal view may be just html code and will not involve PHP code.

3. Laravel

Advantages

1. Laravel’s design idea is very advanced and is very suitable for applying various development models TDD, DDD and BDD

2. Supports composer package management tool

3. It integrates relatively new features of PHP, as well as various design patterns, Ioc containers, dependency injection, etc.

Disadvantages

1. Based on component framework, so it is relatively bloated

4. Code Igniter

Advantages

1.Code Igniter advocates the principle of "simplicity is beautiful". There are no fancy design patterns, no fancy object structures, everything is so simple. It only takes a few lines of code to start running, and a few more lines of code to output. It can be said to be a model of "great simplicity".

2. The configuration is simple, all configurations are configured using PHP scripts, and the execution efficiency is high;

3. It has basic routing functions and can perform routing to a certain extent;

4. It has preliminary Layout function and can create a certain level of interface appearance;

5. The database layer is well encapsulated and has basic MVC functions.

6. It is fast and concise, and the code is not Many, high execution performance,

7. The framework is simple, easy to use, low learning cost, and the documentation is detailed;

8. It comes with many simple and easy-to-use libraries, and the framework is suitable for small applications.

Disadvantages

1. The implementation itself is not ideal.

2. The internal structure is too confusing. Although it is simple and easy to use, it lacks expansion capabilities.

3. Simply understand the Model layer as database operations.

4. 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 and encapsulate the data operation layer. It's pretty good, and CodeIgniter doesn't use many too complex design patterns, and its execution performance and code readability are both good. As for the additional library, it is also pretty good, simple and efficient.

5. Zend Framework

Advantages

1. Extensive application of new object-oriented features in PHP5: interfaces, exceptions, abstract classes, SPL etc. The application of these things makes Zend Framework highly modular and flexible

2. Strictly follow the principles of "programming for interfaces" and "single object responsibility"

3.Officially produced, self-produced It brings a lot of libraries, and the framework itself uses a lot of design patterns to write. It is very elegant in architecture and has medium execution efficiency.

4. MVC design, relatively simple

5. It has routing function. The configuration file is relatively powerful (can handle XML and php INI)

6. Can intuitively support the Model layer in addition to database operations (better than CodeIgniter and CakePHP), and can easily use the Loader function to load other newly added Class

7. The Cache function is very Powerful, it supports everything from front-end Cache to back-end Cache. Back-end Cache supports Memcache, APC, SQLite, files, etc.

8. The database operation function is very powerful and supports various drivers (adapters)

9. The documentation is very complete, and it is very mature in the domestic community

Disadvantages

1. The MVC function is relatively weak, and the View layer is simply implemented (the same as not being implemented) ), unable to control the front-end page very powerfully.

2. Without automated scripts, creating an application, including the entry file, must be built manually, and the entry cost is high

3. For simple and For small projects, on the contrary, because a large amount of object-oriented design is used in the framework, higher requirements are put forward for developers, which indirectly increases the development cost of the project

Evaluation

As an officially produced framework, Zend Framework’s ambitions are foreseeable. It wants to crowd out other frameworks, while encapsulating many powerful class libraries to provide one-stop framework services, and their development team is very strong. , 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

6. CakePHP

Advantages

1. The framework most similar to RoR, including design method and Active Record method of database operation

2. The design level is very elegant, there is no extra library, all functions are pure frameworks, and the execution efficiency is not bad

3. The hasOne and hasMany functions of the database layer are very powerful. More suitable for complex business processing

4. Routing function, configuration difficulty is moderate

5. The automatic scaffolding (scaffold) is very powerful and suitable for medium-sized applications

6.Basic Implemented every layer of MVC

7. Has the function of automatically operating command line scripts

8. The documentation is relatively complete and the learning cost is moderate

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. The cache function is slightly weak

3. The configuration function is a bit weak

4. Not suitable for large-scale applications, only suitable for medium-sized applications. The learning cost is slightly higher for small-scale 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 milestone. 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. ’s

7. Symfony

Advantages

1. Completely implements the three layers of MVC

2. Encapsulates everything, Including $POST, $GET data, exception handling, debugging function, data detection

3. Contains powerful caching function

4. Automatically load Class, and you can freely define various of your own class

5. Powerful language support

6. It has very powerful view layer operations and can contain multiple files in a piecemeal manner

7. Very powerful configuration function , using xml configuration to control all frameworks and program running behaviors

8. Contains powerful multi-level project and application management: Project --> Application --> Module --> Action, which can satisfy a The needs of multiple applications under the 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, and refreshing the cache Wait

10.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. The basic Class is defined at the Project level. In the future, any module can be reused, greatly reusing code.

Disadvantages

1. The biggest problem is that too many open source projects with different styles are used to combine Into a framework

2. Since Mojavi and Propel themselves are quite complex, the structure of Symfony is very complicated and difficult to understand and learn

3. The caching function cannot be controlled, and it is always cached every time it is developed and debugged. , you need to execute symfony cc, symfony rc to clear and rebuild the cache

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

5. The cost of learning is very high, and there is no mature community and Chinese documentation in China

Evaluation

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, so they are naturally recommended for complex projects. It is worthwhile to use Symfony to handle 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 Constructing the model layer

General comments

The above frameworks have their own characteristics, and they are all open source projects, but the projects targeted by the frameworks are different. Generally speaking:

1. Small projects: CodeIngiter

2. Medium projects: CakePHP, Zend Framework, Laravel, Thinkphp

3. Large heavyweight projects: Yii, Symfony, Laravel

The above divisions are not absolute. 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.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of Seven mainstream PHP frameworks, how many have you used?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
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