Introduction
to Yii2 Framework
What is Yii?
Yii is a high performance, component-based PHP framework for rapidly
developing modern Web applications.
What is Yii2?
Yii currently has two major versions available: 1.1 and 2.0.
Version 1.1 is the old generation and is now in maintenance mode. Version 2.0 is a complete rewrite of Yii,
adopting the latest technologies and protocols, including Composer, PSR,
namespaces, traits, and so forth.
Yii2 was under development for more than a year. As it is mentioned in official
documentation, Yii2 is a complete rewrite of Yii1.1.
What are the major changes in
Yii2?
PHP Version
One of the
basic and most important changes in Yii2 is Yii 2.0 requires PHP 5.4.0
or above. Yii2 is built using most of latest features provided in PHP
release version 5.4.0. Make sure your server is running PHP version 5.4.0
or above before choosing Yii2.
Introduction of Namespaces
From PHP
version 5.3.0, Namespaces were introduced in PHP programming. Due to
the large number of libraries for PHP, the chances of name collision in
different libraries became a real problem. Namespaces will help us to remove
such problems. Namespaces are just like a folder which groups the files for a
library.
Yii2 and Namespaces
Yii2 is built
completely using namespaces. So we have to be familiar with using namespace in
PHP programming in order work with Yii2. Here is good tutorial for how to
use namespaces in PHP. Once you are ready to work with namespaces you are
almost good to start development in Yii2 framework.
Integration with Bootstrap
Like
the close integration with jQuery in Yii 1.1, Yii 2 is having a close
integration with Bootstrap HTML Framework. Infact all the widgets are modified
so that we can customize the html properties of those widgets in order to match
the bootstrap structure. This will be very useful for modern web application
development because most of the designs are now based on bootstrap html
framework.
Yii2 Basic and Yii2 Advance
Yii2
framework is available in two templates, first one is basic and the other is
advanced. Usually most of the projects will require only the basic template
unless you really want to use advanced template. Advanced template provide multiple
tires of application with individual application files sharing some common
configuration. Basically the advanced template will help to create multiple
application with sharing some common config such as db configuration. This
helps us to create and application for frontend and a separate application for
the backend. This is not required for most of the projects.
Structure of Yii 2 Framwork Files
1
2
3
4
5
6
7
8
9
10
11
|
assets/
contains assets definition
commands/
contains console commands (controllers)
config/
contains application configurations
controllers/ contains
Web controller classes
mail/
contains view files for e-mails
models/
contains model classes
runtime/ contains
files generated during runtime
tests/ contains
various tests for the basic application
vendor/
contains dependent 3rd-party packages
views/ contains
view files for the Web application
web/ contains
the entry script and Web resources
|
Unlike
with Yii 1, standard installations of Yii 2 results in both the framework and
an application skeleton being downloaded and installed. The core framework files
are stored in the vendors folder.
For more information, please visit : www.programmingyan.com
No comments:
Post a Comment