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

Installation

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 www.yiiframework.com 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 www.yiiframework.com 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 (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
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 🙂

 

No Comments

Leave a Reply

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

Google
PC/Internet Tricks

101 Amazing PC / Internet Tricks no one told you before   You Can Search Google Timer In Google For A Timer With Alarm Search This In Google For Direct Mp3 Links intitle:index.of?mp3 Your song name here Use Your Chrome Browser As Notepad Quickly. Just copy the text below to the address Bar. …

develope
Yii2.0 Dynamic Model Creation

As per my previous shared post you have to know what is Yii 2.0 and its awesome features. If you not read these posts please read this and know little bit about Yii2.0 basic(API Web APP) . Today I am sharing you a very new feature of Yii 2.0 which will …

Google
Magento script for get collection of multiple product id’s data

As today shared in my magento article, i shared you a query trick by which you will get all sold product data with single query, Now i am going to share you a simple script by which you will get multiple product ids data with single and well optimized code …