What is Yii
Yii is a PHP framework used to develop various types of web applications. Yii officially defines it as a high-performance, component-based framework.
In terms of personal experience, Yii has the following characteristics:
Yii is more "trendy".
The Yii development team has always been paying attention to the latest technologies in web development in the industry, and pays great attention to absorbing the most popular technologies at the moment. It can be said that the most trendy technologies in web development in recent years can be seen more or less in Yii. For example, Yii had an obvious Ruby on Rails style when it first started; for example, the namespace and other PHP latest features just implemented in Yii2 were supported. Only a framework that keeps up with trends and trends will be attractive and vital, and will be interesting and meaningful to learn.
Yii is relatively "easy".
As its name sounds, Yii is a framework that is relatively easy to learn and use. The code quality is very high and there is a lot to learn. Clear comments and rich documentation make it easy to read the code. The community is active, the official forum has a Chinese section, the domestic forum is also quite popular, and it is easy to obtain knowledge. The architecture is relatively stable. Judging from the changes from Yii1.1 to Yii2, many of the original conventions and accumulated experience are still applicable.
Yii is more "complete".
As far as web development is concerned, no matter what type of application it is, no matter what stage of development the common problems are, Yii has mature, efficient, and reliable solutions. For typical web development, this is sufficient. For example, Yii provides programming frameworks for pseudo-static, internationalization, RESTful, etc. However, in terms of scale, Yii is not yet a large framework. My personal evaluation is that it is a medium-sized and light framework, which is definitely sufficient and sufficient for most application development.
Yii is relatively "fast".
Yii officially promotes operating efficiency as an important feature. Judging from actual use, among many PHP frameworks, it does have certain advantages in efficiency. But personally I think this is not the most important feature. For users of the framework, that is, developers, development efficiency is more important. Due to Yii's reasonable architecture, ideas and patterns commonly used in web development can be easily applied. For some detailed problems often encountered in web development, Yii also provides many ready-made solutions that can be used immediately, which are very efficient and convenient. High development efficiency is even more important for developers and development teams.
I would like to thank the Yii development team for their unremitting efforts in striving for excellence and creating such an excellent framework for the majority of web developers. I have been exposed to and used Yii since Yii1.1. Due to work and hobbies, I have also been exposed to some frameworks. Generally speaking, I am very satisfied with Yii so far. What I like most about Yii are two things: after learning Yii, I learned many of the most popular and mature things at the moment; it can be developed quickly and improved quickly.
Highlights of Yii2.0
Yii has two main versions: Yii1.1 and Yii2.0. Yii1.1 is an old version. At the time of writing this book, the latest version number is 1.1.15. Yii1.1 is no longer undergoing new development. The official is only performing maintenance and updating security vulnerabilities. No new features will be introduced. Yii2.0 is a framework that was completely overthrown and rewritten on the basis of Yii1.1. It absorbs many of the latest technologies and mainstream conventions in development, and is the representative of the latest generation of Web development frameworks. Appendix 1: Major improvements between Yii2.0 and Yii1.1 This section introduces the major improvements between Yii2.0 and Yii1.1. Below we briefly introduce some of the more prominent features of Yii2.0:
It uses new technologies and standards such as PHP namespace, Trait, PSR standard, Composer and Bower package manager.
Implemented new architecture and new patterns such as dependency injection, dependency injection container and service locator (Service Locator).
Yii2.0 attaches great importance to security and adopts a series of measures to effectively prevent SQL injection, XSS attacks, CSRF attacks, cookie tampering, etc.
It widely supports various SQL and NOSQL databases, efficiently implements database query and operation interfaces such as Active Record, and provides functions such as database migration, replication, and read-write separation.
A fully standards-compliant RESTful API can be implemented with a minimal amount of code.
Supports caching mechanisms of various granularities and media.
Provides a variety of authentication and authorization methods based on cookie and token-based authentication, RBAC and other permission control methods, and supports OpenID, OAuth1, OAuth2, etc.
Supports Bootstrap, jQuery UI, and provides a wealth of Widgets for use.
Complete international support, providing time, plural and other formatting tools that comply with ICU standards, as well as functions such as message translation and view translation.
In addition to supporting two mainstream PHP template engines, Twig and Smarty, developers can also write their own extensions to support other engines.
It provides efficient development tools such as Yii debugging toolbar, Gii code generator and document generator for hard-working coders.
Integrated with Codeception and Faker, and combined with DB Migration, it provides a fixture framework to facilitate test development.
It provides a simple application template and an advanced application template, which are suitable for different development scenarios and can help developers build their own applications as soon as possible.
For detailed Yii2.0 functional features, please view the official description.
background knowledge
Please note that although this book focuses on Yii2, it does not require readers to have development experience in Yii1.1. Although having this background knowledge can help you master Yii2 faster, during the explanation process, this book will help readers who have no relevant knowledge of Yii1.1 to supplement relevant concepts. As long as you have these concepts, readers do not need to learn Yii1.1 from scratch and can start using Yii2 directly.
Of course, as Yii is a PHP framework, it is best for readers to understand PHP. You do not need to be proficient in it. You only need to understand the code, be able to write simple code, and roughly know which functions to use when programming, which is basically enough. , learning while using it is also a learning method.
At the same time, Yii is also an object-oriented framework. This means that Yii embodies object-oriented thinking in terms of code organization and problem solving. To develop with Yii, it is best to follow this idea. Therefore, readers are advised to have some understanding of object-oriented programming. In fact, judging the level of a programmer is not just the proficiency of a certain language or a certain development framework. More importantly, it depends on its ideas and methods for solving problems. One major category of methods is object-oriented methods. From this point of view, learning and using Yii does not require advanced object-oriented methods. But as someone who has experienced it, I still hope that all readers can learn object-oriented development methods systematically and comprehensively. In particular, this book will also specifically explain the design patterns commonly used in web development when they are involved.
How to read this book
This is not a "quick start" or "mastery in a week" book. A very important purpose and starting point of this book is to analyze the principles of Yii2.0 so that readers know both what it is and why it is, which is doomed to be unpredictable. It might happen overnight. There is a lot of code in the book, which requires analyzing the data structure, tracing the call stack, and tracing the code flow. Although we strive to be vivid and concise, readers still need to be mentally prepared for "ancient Buddha green lantern", not to be impetuous or impatient, to concentrate on practicing internal skills, to have a solid foundation, and to practice unique skills as soon as possible.
In terms of content, this book points directly to the essence of Yii2.0 and strives for refinement rather than perfection. For related PHP, HTTP and many other knowledge, it only touches on it at the most, and it is only superficial and fails to introduce it. Therefore, for the related knowledge and background knowledge involved, we must make full use of search engines and other tools to conduct self-study and supplement.
In terms of chapter structure, the book generally arranges the content in a gradually in-depth pattern. At the same time, the content of each part remains relatively independent, and the content of each individual page can be made into an independent article as much as possible. Therefore, readers who are new to Yii2.0 are advised to read it step by step. Readers with a certain foundation can freely choose the entry point for learning based on their personal interests and hobbies. When they encounter a knowledge point in question, they can search for relevant pages by searching for the relevant pages.
In the Yii basics section, the most basic knowledge in Yii such as Properties, Events, and Behaviors are introduced in sequence, which are the most basic concepts for understanding the entire Yii framework.
In the Yii Conventions section, it mainly explains some routines and settings of Yii conventions. It solves the problem of Yii's default behavior when the developer does not specify anything, and is used to deepen the understanding of the actual use of Yii. This part mainly includes the directory structure and entry script of Yii application, alias (Alias), Yii's automatic class loading mechanism, environment and configuration files, configuration items (Configuration), etc.
In the Yii Patterns section, we analyze how Yii implements some of the most mainstream and mature design patterns in current web development. Learning these design patterns will help you deeply understand the mechanism of Yii, and even more rare is to improve the development and design level of readers. This part mainly talks about the three design patterns of MVC, dependency injection and dependency injection container, and service locator (Service Locator).
Statement:
All resources on this website are contributed and published by netizens, or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this website are for learning and reference only. Please do not use them for commercial purposes, otherwise you will be responsible for all consequences incurred! If there is any infringement, please contact us to delete and remove it. Contact information: admin@php.cn