Yii is so much faster because it is using the lazy loading technique extensively.For example: it does not include a class file until the class is used for the first time, and it does not create an object until the object is accessed for the first time. Other frameworks suffer from the performance hit because they would enable a functionality (e.g. DB connection, user session) no matter it is used or not during a request.
- Model-View-Controller (MVC) design pattern
- Database Access Objects (DAO), Query Builder, Active Record, DB Migration
- Form input and validation
- AJAX-enabled widgets
- Skinning and theming
- Web Service available for Apps like android
- Internationalization and localization translation for multilingual
- Caching for speed up the application
- Error handling and logging for tracking
- Security: cross-site scripting (XSS), cross-site request forgery (CSRF) protection
- PHPUnit and Selenium for testing
- Automatic code generation help us to fast development
- Authentication and authorization
- Friendly with third-party code
- Extension library
Component: A component is an independent piece of code written for specific task that can be used by calling in controllers (example : email component).
Helper: Yii provides many classes that help simplify common coding tasks, such as string or array manipulations, HTML code generation, and so on. These helper classes are organized under the yii\helpers namespace and are all static classes (meaning they contain only static properties and methods and should not be instantiated).You use a helper class by directly calling one of its static methods, like the following:
- Core Helper Classes
- Customizing Helper Classes
1. Core Helper ClassesThe following core helper classes are provided in the Yii releases:
- Imagine (provided by yii2-imagine extension)
2. Customizing Helper ClassesTo customize a core helper class (e.g. yii\helpers\ArrayHelper), you should create a new class extending from the helpers corresponding base class (e.g. yii\helpers\BaseArrayHelper) and name your class the same as the corresponding concrete class (e.g. yii\helpers\ArrayHelper), including its namespace. This class will then be set up to replace the original implementation of the framework.
these only adds to modularity in code otherwise same coding can be implemented in controllers.
- db- database connection.
- assetManager - manage the publishing of private asset files
- authManager - manage role-based access control
- cache- manage caching functionality
- coreMessages- provides translated core messages
- errorHandler- manage errors handling.
- themeManager- Manage themes
- urlManager- URL parsing and creation functionality
- statePersister- mechanism for persisting global state
- session- Session management
- securityManager- Security Managment
render() is commonly used to render a view that corresponds to what a user sees as a “page” in your application. It first renders the view you have specified and then renders the layout for the current controller action (if applicable), placing the result of the first render into the layout. It then performs output processing and finally outputs the result. i.e) render with theme.
renderPartial() is commonly used to render a “piece” of a page. The main difference from render() is that this method does not place the results of the render in a layout. By default it also does not perform output processing, but you can override this behavior using the $processOutputparameter. i.e) render without theme.
renderFile() is a low-level method that does the grunt work of rendering: it extracts the data variables in the current scope and then runs the view code. The other two methods internally call this one, but you should practically never need to call it yourself. If you do, keep in mind that you need to pass in a file path (not a view path).
- PHP 5.4 or above
- mbstring extension
Active Record, it provides an object-oriented interface for accessing and manipulating data stored in databases.
Gii is a web-based code-generator module provided by Yii framework
It helps you create and generate fully customized forms, models, CRUD for database and more