Content of the «Special Topics» section:
- Advanced Project Template
- Building Application from Scratch
- Console Commands
- Core Validators
- Performance Tuning
- Shared Hosting Environment
- Template Engines
- Working with Third-Party Code
- Using Yii as a micro framework
Articles section «Special Topics»:
Using Yii as a Micro-framework
Yii can be easily used without the features included in basic and advanced templates. In other words, Yii is already a micro-framework. It is not required to have the directory structure provided by templates to work with Yii.
Working with Third-Party Code
From time to time, you may need to use some third-party code in your Yii applications. Or you may want to use Yii as a library in some third-party systems. In this section, we will show how to achieve these goals.
Using template engines
view component is responsible for rendering views. You can add a custom template engine by reconfiguring this component's behavior:
Shared Hosting Environment
Shared hosting environments are often quite limited about configuration and directory structure. Still in most cases you can run Yii 2.0 on a shared hosting environment with a few adjustments.
There are many factors affecting the performance of your Web application. Some are environmental, some are related with your code, while some others are related with Yii itself. In this section, we will enumerate most of these factors and explain how you can improve your application performance by adjusting these factors.
Note: This section is under development.
Yii supports composition and sending of the email messages. However, the framework core provides only the content composition functionality and basic interface. Actual mail sending mechanism should be provided by the extension, because different projects may require its different implementation and it usually depends on the external services and libraries.
Internationalization (I18N) refers to the process of designing a software application so that it can be adapted to various languages and regions without engineering changes. For Web applications, this is of particular importance because the potential users may be worldwide. Yii offers a full spectrum of I18N features that support message translation, view translation, date and number formatting.
Yii and Docker
For development and deployments Yii applications can be run as Docker containers. A container is like a lightweight isolated virtual machine that maps its services to host's ports, i.e. a webserver in a container on port 80 is available on port 8888 on your (local)host.
Yii provides a set of commonly used core validators, found primarily under the
yii\validators namespace. Instead of using lengthy validator class names, you may use aliases to specify the use of these core validators. For example, you can use the alias
required to refer to the [[yii\validators\RequiredValidator]] class: