Home>Article>Backend Development> What are the commonly used frameworks in php? What are its advantages and disadvantages? (share)
This article will share with you what are the commonly used frameworks in PHP? What are its advantages and disadvantages? It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
1. ThinkPHP
ThinkPHP (FCS) is a lightweight A medium-sized framework, it is a Chinese PHP development framework transplanted from Java's Struts structure. 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
With mature Java ideas
Easy to get started, rich Chinese documentation ;Low learning cost, high community activity
The framework has strong compatibility, PHP4 and PHP5 are fully compatible, and fully supports UTF8, etc.
Suitable for the development of small and medium-sized projects
Introducing the composer package management tool from thinkphp3.2.2
Disadvantages:
The support for Ajax is not very good;
The directory structure is confusing, compared to other frameworks The directory structure is a bit different;
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:
Pure OOP
For large-scale web applications
The model is easy to use
The development speed is fast and the running speed is also fast. Excellent performance and feature-rich
Use command line tools.
Support composer package management tool
Disadvantages:
Yes Less guidance and consideration at the Model layer
Fewer document examples
Too much English
Requires proficiency in PHP technology and proficiency in OOP programming!
View is not an ideal view. The ideal view may only be html code and will not involve PHP code.
3. laravel
Advantages:
laravel design The idea is very advanced and very suitable for applying various development modes TDD, DDD and BDD
Support composer package management tool
Integrated PHP Newer features, as well as various design patterns, Ioc containers, dependency injection, etc.
Disadvantages:
1. Based on component-based framework, so it is relatively bloated
4. CodeIgniter
Advantages:
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".
The configuration is simple, all configurations are configured using PHP scripts, and the execution efficiency is high;
has basic routing functions and can perform operations to a certain extent routing;
has preliminary Layout function and can create a certain level of interface appearance;
The database layer is well encapsulated and has basic MVC function.
Fast and concise, not much code, high execution performance,
Simple framework, easy to use, low learning cost, detailed documentation ;
It comes with a lot of simple and easy-to-use libraries, and the framework is suitable for small applications.
Disadvantages:
The implementation itself is not ideal.
The internal structure is too confusing. Although it is simple and easy to use, it lacks expansion capabilities.
Simply understand the Model layer as a database operation.
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 is not too complicated to use. The design pattern is good in terms of execution performance and code readability. As for the additional library, it is also pretty good, simple and efficient.
5. Zend Framework
Advantages:
It uses a large number of object-oriented features in PHP5 New features: interfaces, exceptions, abstract classes, SPL, etc. The application of these things makes Zend Framework highly modular and flexible
strictly follows the principles of "programming for interfaces" and "single object responsibility"
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.
MVC design, relatively simple
It has routing function and the configuration file is relatively powerful (can handle XML and php INI)
can intuitively support other than database operations Model layer (stronger than CodeIgniter and CakePHP), and can easily use the Loader function to load other newly added Class
Cache function is very powerful, supporting both front-end Cache and back-end Cache , the back-end Cache supports Memcache, APC, SQLite, files, etc.
The database operation function is very powerful and supports various drivers (adapters)
The documentation is very complete and it is very mature in the domestic community
Disadvantages:
MVC function completion is relatively weak, View The layer is simply implemented (the same as not implemented), and cannot control the front-end page very powerfully.
There is no automated script. To create an application, including the entry file, all must be built manually by yourself, and the entry cost is High
For simple and small projects, on the contrary, because a large number of object-oriented designs are applied in the framework, higher requirements are put forward for developers, which indirectly increases the development of the project. Cost
Evaluation:
As an officially produced framework, Zend Framework’s ambition is foreseeable, and it wants to squeeze out other frameworks, and at the same time It encapsulates many powerful class libraries and can provide one-stop framework services. Their development team is very powerful and fully capable of developing very powerful products. Therefore, it is basically certain that Zend Framework has a bright future. If you spend more time to perfect 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:
The framework most similar to RoR, Including the design method, the Active Record method of database operation
The design level is very elegant, there is no extra library, all functions are pure frameworks, and the execution efficiency is not bad
The hasOne and hasMany functions of the database layer are very powerful and suitable for complex business processing
Disadvantages:
Evaluation:
Generally speaking, the CakePHP framework represents a very important era and representative of the PHP framework, and currently plays a very important role. Function, many self-written frameworks imitate the CakePHP method, which is a landmark product; CakePHP reveals RoR's agile development method and the design idea of considering database operations as the only model. It is excellent for developing rapid applications and prototypes. Tools; similarly, the development framework for Web2.0 websites is also worth choosing7. Symfony
Advantages:
Very powerful configuration function, using xml configuration to control all frameworks and program running behaviors
Includes powerful multi-level project and application management: Project - -> Application --> Module --> Action 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.
Symfony is definitely the first choice for developing large and complex projects, because Symfony is used , will greatly save development costs, and no problems will occur when multiple people collaborate. After defining the basic Class at the Project level, any module can be reused, greatly reusing code.
Disadvantages:
The biggest problem is that too many open source projects with different styles are used to combine them into a framework
Since Mojavi and Propel themselves are quite complex, the structure of Symfony is very complex and difficult to understand and learn.
The cache function cannot be controlled. 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
is not very efficient, especially the process of parsing templates and reading configuration files, which takes a lot of time
The learning cost 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. Naturally, it is recommended to use Symfony to handle complex projects. I think it is worth it. Later The maintenance cost is relatively low and the reusability is 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 each have their own characteristics, and they are all open source projects. However, 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 the needs change
The above is the detailed content of the advantages and disadvantages of the seven frameworks commonly used in PHP. For more information, please pay attention to other related articles on the PHP Chinese website!
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What are the commonly used frameworks in php? What are its advantages and disadvantages? (share). For more information, please follow other related articles on the PHP Chinese website!