Today I decided to try to install and write a simple web app using the beta version of Yii Framework 2. I have used Yii Framework 1.1 in a previous project and I liked it, so want to see what version 2 has to offer. My source of documentation is the official definitely guide, which is also in non-fished stage.

Apparently, version 2 of the framework is moving toward installation using Composer, which mimics Bundle from Ruby on Rails.

Install PHP mcrypt

Yii 2 requires mcrypt and my system does not have it installed. The following steps install the module.

sudo apt-get install php5-mcrypt
sudo mv -i /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/
sudo php5enmod mcrypt
sudo service apache2 restart

Install Composer

The following command installs Composer in the bin directory in my home folder (local installation).

curl -sS | php -- --install-dir=bin

Create Project

We can start creating our project using Composer, which will create a folder for our project and download dependencies including Yii.

As of writing, we can only install the dev version of Yii. The stable channel does not work. The following installs the development version, and create a project folder called basic

~/bin/composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic