Skip to content

Yii2 based web application

After a long time i’m going to write a tut for you. Today i am just trying  to explain you how you can build your web application using Yii2 PHP framework. We know that Yii2 is stand for ‘Yes it is’, by the help of this framework developer can build his/her web application easily without face any problem.

This is not only a framework, this is the real soul of php with quite good modifications.

Let me explain, How you can build your web app

  1. Installation
  2. Demo School Project
  3. Your views


There is the Two version of Yii2 is available in market. First one is the  Yii2 basic and another one is Yii2 advance. let me describe you difference of this two Yii2. In basic you have only front-end mean if you want to make one front website then this is for you, but if you want to make a complete CMS type system then Advance is for you. in Advance version you will get backend and frontend in your system, In this installation i will show you how you can install both version in your Linux pc/laptop..

Basic Yii2 installation

  • Just go on and download the basic version of Yii2 .
  • For start Yii2 in your localhost put the extract file in your xampp or lampp root directory.
  • Then go inside of  your yii2-basic folder and open your config sub folder of your yii2-basic and then you will that there is four file in those files db.php is using for connect to your yii2 to with your specified database, To start yii2 modify the config/web.php file by entering a secret key for the cookieValidationKey configuration item (this is done automatically if you are installing Yii using Composer):
  • Then open your browser and type localhost/your-yii2-basic-folder-name..

After those process your yii2 will start in your browser and then you can easily create your project…

Advance Yii2 installation

  • Just go on and download the advance version of Yii2 .
  • For start Yii2 in your localhost put the extract file in your xampp or lampp root directory.
  • Then install latest php version in your Linux/wondows and the execute this command in your cmd or terminal
    php /path/yii2-advance/init

    Or in production execute init in non-interactive mode.

    php /path/to/yii-application/init --env=Production --overwrite=All
  • Create a new database and adjust the components['db'] configuration in common/config/main-local.phpaccordingly.
  • Apply migrations with console command  yii migrate.

Now your yii2 advance version is ready for use 🙂

Demo School Project

In  this demo i’m using basic version of yii2 and in that i will install new theme for my project and then create grid of my school students with there details as like Data table of jquery.

  • Before start coding part create a simple database in your db create the table.
CREATE TABLE demoschool (
firstname VARCHAR(30) NOT NULL,
lastname VARCHAR(30) NOT NULL,
email VARCHAR(50),
reg_date TIMESTAMP
  • After create table in your database open your yii2 folder project in your editor.
  • And set your database name in your config>db.php file.
  • Then install AdminLte theme in your yii2 by composer as explain on this link yii2-adminlte-asset
  • After installation create CRUD operation for your school students list. For that open your gii module in your browser. Gii module will create CRUD operation file without any coding, So for that go in browser and type this address localhost/yii2-dir/web/index.php/gii and then select CRUD operation after fill the CRUD operation your CRUD operation is ready and ow your school student list is ready..

Hope you like this. If you have any query about anything about yii2 you can ask me i will try to figure out your problem .. Thanks

My third part is missing without your view. Be share this 🙂


Previous article

Two Best WordPress Themes For Blogging

Next article

Yii2 base Rest API Creation

Join the discussion

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: