Easily getting started - Installing Yii2

Brief introduction to installing Yii2 framework to a website

Using the terminal window (on OSX), first install composer.

This will install the latest version (from http://getcomposer.org/download):

php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php
php -r "if (hash('SHA384', file_get_contents('composer-setup.php')) === '7228c001f88bee97506740ef0888240bd8a760b046ee16db8f4095c0d8d525f2367663f22a46b48d072c816e7fe19959') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"


Then in the directory in which you are working, initialise it:

php composer.php


Then to install the correct version of yii (from http://www.yiiframework.com/download/):

Install the composer asset plugin:

php composer.phar global require "fxp/composer-asset-plugin:~1.1.1"


Then the yii files:

php composer.phar create-project yiisoft/yii2-app-basic basic 2.0.7


or the advanced:

php composer.phar create-project yiisoft/yii2-app-advanced advanced 2.0.7


Here is an excellent tutorial on where to go next: