Understand Yii2 Data Flow basics

Yii2 Data Flow
Yii2 Data Flow


Understand Yii2 Data Flow basics

Learn how yii2 data flow works

Application Directory Structure

There are three main applications in advanced Yii2 template, frontend, backend and console web applications.

  • Backend web application mainly used by super admin to manage entire system.
  • Frontend web application targets our end users – for whom we are developing.
  • Console application is used to run commands like CRON job etc.

Besides all these we have another folder in the advanced template called “common” which is used to share resources among above three web apps.

Yii2 works in MVC patter so we have following three folders inside every web application (frontend, backend & console).

  • Models: are tables
  • Views: are interfaces (NOT present in console app)
  • Controllers: are intermediate between Models and Views to control flow of data.


URL Structure:

You can enable or disable pretty URL and Script Name by going frontend/config/main.php

Data Flow

Yii2 URL structure implies controller/action mechanism means you need to call certain action method within controller.

Whenever this URL is called control will find action inside controller and execute it.

Suppose site/index  is inserted in the URL address, it will search for Index action inside site controller.


This method will get data from search Model and pass it to view/site/index.php  like showing in the following data flow diagram.


I am a Sr Android App, Web Developer & Blockchain Project Manager having 5 plus years of extensive hands-on experience in Object Oriented Programming, Database Design and Implementation using Agile & UML. Pro in Yii2 PHP Framework, Android App Development, MYSQL, EOS & Etherium Blockchain & Smart Contract development.

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

More in Yii2

Recent Posts


To Top