Thinkphp and Yii which is better, respectively, what are the best?

Source: Internet
Author: User
Keywords Php
Tags yii
PHP Framework

Reply content:

On the comparison between TP and Yii, the first point is that YII and TP are not a hierarchy of things (know the difference between the Isaiah and the super-race?). In addition, the individual particularly disgusted TP, there is a big reason is that tp too self-righteous, do a lot of things to facilitate the people, for example, there is a pork boss selling you pork, you want a catty of lean meat, he gave you two pounds of bone a catty fat one or two lean meat, this is TP, and Yii is the boss next door, He will give you a catty. Yii with the configuration and components, such as the effect is, you want what he gave you what (the focus is you will not configure, so difficult to learn), TP is everything is done, it seems to be easy to use, in fact, the level is someone pulled several grades thinkphp and Yii is not a measure of the things ... Xie invited
---------
First, the conclusion: Yii is better, and much better than thinkphp.
To answer the distinction between what is good we must first understand what the framework is used to do.
The role of the framework: 1, simplified development. 2, improve the maintainability of the project. 3, avoid the programming language itself pits and traps.
Then we will discuss the merits and demerits of the two from these 3 aspects.
1, to simplify the development aspect: from the Novice's point of view (or superficially), thinkphp makes the project easier, because it provides most of the common web Development Library, the second Chinese manual written in very detailed. But in fact, Thinkphp has two missing features that can cause headaches if the project is done long or slightly, and the two features that are missing are: full AR support and a complete multi-layered model
Secondly, most of the code in Web project development is duplicated, so the automated code generation tool is essential, and as of the latest tp3.2.3, I still don't see any indication that TP has any support for automation tools.
2, maintainability, missing a complete AR and multi-level model, code can not be neat to where to go, code a lot, source code must be as messy as noodles. Most importantly, TP has no unittest, which leads to refactoring without doors. Similarly, the database, TP missing data Migration Tool, which led to the late maintenance of the project by a great difficulty
3, avoid the programming language itself pits and traps: TP and Yii are made by PHP implementation, PHP itself has a lot of pits and traps, such as chaotic language structure and function silly confusing relationship, variable conversion trap, messy class library naming. These are basically improved in Yii, Yii is completely object-oriented approach to build, common web libraries are presented in the form of components, and finally improve the PHP programmer side Write code side baidu: ' xx function which function ' of the case. The inverse TP, only for the Common class library package into class, what to take what, have not done a careful design, exactly like a years of programmers save some class library, and then patchwork a framework, so I often say, thinkphp is a pseudo-MVC framework.
-----------------------------------------------------
Say in the last words:
Above I spit a lot of thinkphp bad, but in fact, from the production environment, thinkphp is fully qualified, the current domestic most projects are built on TP. From the operating practice, TP fully meet the production standards, the largest number of users. The topic asked TP and yii that excellent, nature is yii excellent, which is like, Python, no matter from what aspect, is better than PHP, but with the person is not php more than one reason overall said Yii is better, the advantage is lightweight, cache do good, There are many implementations that are good at avoiding dependency on PHP extensions, performing higher performance than TP, and so on.
Of course, Th also has its own somewhat. For example, the community is very popular, the Chinese novice tutorial is very detailed, relatively easy to get started. Shortcomings are also obvious, such as many bugs .... Have not played thinkphp, at least Yii2 internationalization to do better, thinkphp localization is better.

First, if someone believes that we should unconditionally support domestic:
Support Patriot Camera, the new machine will be installed 360 security defender, internet default hundred poison search, sick only see Chinese medicine, like the default recommendation of domestic news client, to chicken Blood Forum, see people 艹 newspaper and Universal excrement newspaper, never turn the wall, resolutely boycott Japanese goods ...
Then I think this kind of person may not be suitable for programming this industry.

As for the difference, the first point is actually very easy to overlook, that is, the influence of the international famous Framework benchmark will not consider thinkphp. All aspects of the information is not easy to find, domestic technology paste quality and quantity are difficult compared with the world. The world's most well-known technical question and answer website StackOverflow is also no thinkphp.

Of course, if the international demand for zero, their English is not very good, then thinkphp is not necessarily a bad choice. In particular, the developers are people, and there is no foreign and local large customers in the case. And after applying composer, the framework components can be mixed in theory to support the PSR Standard. The only advantage of YII is that the core developer is a PSR producer, a member of the PHP framework collaboration organization.

For technical choices, the only advice is not to support the technology platform, but to objectively compare whether they apply to the current application scenario. The simplest example is NoSQL, and the choice of which database depends on the application scenario. Some of the other data storage scenarios are not impossible to do, but are more adaptable scenarios. Mysql/mongodb/cassandra is the problem in all scenarios. Similarly, if you prefer the design of a lightweight RESTful backend + heavy front end, you can choose to use micro-framework, such as the SLIM framework or Selix. If you have a high performance requirement, you can choose to use Micro-orm instead of ActiveRecord, and if the business is complicated, I think maybe ActiveRecord is not enough, and I have to use datamapper or even Repository Pattern. No frame can ever be said to cover 100%, neither can be done, nor is it necessary.

Laravel/symfony In fact is also worthy of recommendation, the former syntax sugar is very good, a lot of fans, the latter and flexible, the author is also very famous in the PHP world.
It's just that they don't really care about performance at some point. This "A and b which is good" question is nonsense, always remember a little, no matter what the best for their own, such as you want to do a few simple pages, that any framework is superfluous! Not a good, look LZ tacit. Two of them have been used. If you want to quickly recruit people, recruit the level of people not too high, come to not hemp claw. TP is the right choice. In contrast, Yii Lavara Symfony can be very powerful yii. thinkphp, more than two times the source code you understand. I'm just taking thinkphp as a class library right now. That is, some common methods, directly from the thinkphp inside copy out ... Province's own online find ...
It is highly recommended that you study yii. It's very good. His cache is very good. I suggest you use ThinkPHP5. I read a lot of contrast stickers, summed up some


TP Good, a lot of people in China, rapid development, easy to learn, he meant to say that he learned TP
Yii good, foreign, forced lattice natural high, the level of natural high, he meant to say, he learned yii

Personal feeling, TP and Yii are OK, both use a lot of people, documents also more, do not learn other frameworks, such as CI What, in fact, I mean to say, I TP and Yii have learned
  • 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.