Blog

From CI to Yii

Yes It Is Simple!

CodeIgniter Yii
Global Reference $CI = &get_instance() Yii::app()
Loading Classes $CI->load Yii::import
Base URL site_url() Yii::app()->baseUrl
URL creation site_url($path) Yii::app()->createUrl($route, $params)
Routes routes.php main.php => urlManager
Naming Underscore and Capitalization for classes camelCase everywhere other than DB
Helper functions Present No predefined folder, but it can be added
Class Prefix CI_ C
Base Controller CI_Controller CController
Intermediate Controller MY_Controller extends CI_Controller Controller extends CController
Approach Singleton Pure OO with ORM
Folder separator / (Forward Slash) . (Dot, like Java)
Path Aliases - Absent - Yii::setPathOfAlias(‘bootstrap’, dirname(__FILE__).’/../extensions/bootstrap’);
Configuration files /application/config/config.php, constants.php, database.php, routes.php main.php
Autoload autoload.php main.phparray(‘import’=>[‘ ‘])
Rendering sequence header => body => footer body => layout
Third party API folder /application/libraries /application/vendors
Javascript and CSS Custom Built in using Yii::app()->registerCSS, registerJS, clientScript etc

Concepts new in Yii