Reference: http//:www.yiiframework.com
Yii Versions
There are two main versions of Yii
Yii 1.1
It is the initial and old generation and now-a-days it is in maintenance mode.
Yii 2.0
Yii 2.0 is the complete rewrite version of Yii that is enrich with latest technologies and protocols i.e. PSR, Namespaces, Traits and Composer etc.
Yii development team commit that yii 2.0 will grow more for main development.
Yii 1.1 vs Yii 2.0 :
there are some front end level changes in yii 2.0
- we can see that CHtml link is changed totally
- CMenu is changed
- CHtml image link is changed
- Breadcrumbs are changed
Yii 1.1 | Yii 2.0 |
---|---|
CHtml::link() |
Html::a() |
$this->widget('zii.widgets.CMenu', [ 'items'=>[ [ 'label'=>'Home', 'url'=>['site/index'] ], [ 'label'=>'Home', 'url'=>['site/index'] ] ] ]); |
echo Nav::widget( 'items'=>[ [ 'label'=>'Home', 'url'=>['site/index'] ], [ 'label'=>'Home', 'url'=>['site/index'] ] ] ); |
CHtml::img( '/path/to/file', 'alt-text', ['class'=>'img-responsive'] ); |
Html::img( '/path/to/img', [ 'alt'=>'alt-text', 'class'=>'img-responsive' ] ) |
$this->breadcrumbs = [ 'Label'=>['site/labelAction'], 'Current Page Title', ]; |
$this->params['breadcrumbs'] =[ [ 'label'=>'Label', 'url'=>['site/labelAction'] ], 'Current Page Title' ]; |
for more details see the Class Reference
The Change Log of Yii 2.0 (Under Development)
Yii 1.1 and Yii 2.0 Application Hierarchy/ Structure.
lets see the old and new hierarchies of Yii application.
Hierarchy/Structure of Yii 1.1.* Application
index.php index-test.php assets/ css/ images/ themes/ protected/ commands/ components/ config/ controllers/ data/ extensions/ messages/ models/ runtime/ tests/ views/ framework //located outside the web root
Structure of Yii 2.0 Basic Application
Yii 2.0 basic application is for small projects or when you’re just learning the framework.
assets/ // This is *NOT* the web accessible assets folder commands/ config/ controllers/ mail/ models/ runtime/ tests/ vendor/ yiisoft/ <-- equivalent to the "framework" folder ezyang twbs ... <-- Composer installed dependencies (extensions) views/ web/ <-- The web root for your application index.php index-test.php assets/ <-- your published assets folder for the web css/
Advanced Yii 2.0 Application Structure
This template is for large projects developed in teams where backend is divided from frontend, application is deployed to multiple servers etc.
backend/ <-- Site 1 config/ controllers/ models/ runtime/ tests/ views/ web/ <-- The web root for your backend application index.php index-test.php assets/ css/ common/ config/ mail/ models/ tests/ console/ environments/ frontend/ config/ controllers/ models/ runtime/ tests/ views/ web/ <-- The web root for your frontend application index.php index-test.php assets/ css/ vendor/ yiisoft/