3 Easy Steps To Install The Awesome Yii 2 Framework

Thanks For Sharing! :-)Share on Google+Tweet about this on TwitterShare on FacebookShare on RedditBuffer this page


Yii is another powerful PHP Framework created by Qiang Xue and his core team of Alexander Makarov, Maurizio Domba, Carsten Brandt, Timur Ruziev, Klimov Paul, Antonio Ramirez, Wei Zhuo, Sebasti├ín Thierer, and Jeffrey Winesett. Yii is also strongly supported by Larry Ullman, a well known and respected developer and author of countless books on programming. Yii lists several frameworks and technologies as inspiration in it’s development. Prado is listed as an inspiration for the component based, event driven, database abstraction, and modular concepts it is known for. Ruby on Rails is an influence as the Yii Object Relational Mapper is based on the active record design pattern of rails. jQuery is not only an inspiration, but baked into the Yii framework by default. Yii also makes use of Symfony for design inspiration in the plug in and filter architecture. Let’s install Yii 2 right now and check it out!

Yii 2 Installation Steps

Go install composer if you do not already have it installed. It works with any operating system so you’ll be covered no matter what you are using.

1. Add Github Credentials To Composer

Do yourself a favor and add your GitHub credentials to your composer installation to eliminate the annoying rate limits you will encounter using composer without credentials.

Follow the steps here https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens to make that happen for yourself.

2. Configure Asset Plugin

Configure composer for the asset plugin which managing bower and npm package dependencies through Composer.
composer global require "fxp/composer-asset-plugin:1.0.0-beta3"

3. Create a new Yii 2 Project!

composer create-project --prefer-dist yiisoft/yii2-app-basic basic

You’ll see something like this in your terminal:

Sweet! Believe it or not, you now have a fully functioning Yii Web Application built and ready to use. When you install Yii, you can choose to have it create a skeleton application and this is exactly what we just did. Let’s take a look at what we have.

Welcome To Yii

Welcome To Yii

In this scenario, we created a folder named yii in our root directory. This install was completed on Windows, so you we simply right clicked on the folder and chose use composer here which quickly opens a terminal window for us ready to accept composer commands. It is here where you typed the command from steps 3 and 4 above. This created a Yii Application in our newly created basic folder.

First up, you’ll notice that the example application is in a bootstrap style. Bootstrap v3.2.0 is baked right into the Yii repository so you get access to this right off the bat. Nice touch.

The top navbar is responsive and has a company logo or tagline option on the top left, as well as an additional about page, contact page, and login page. These are all functional by the way right upon install. Clicking the about link brings us to:


This is the About page. You may modify the following file to customize its content:


Clicking the contact links brings up a very nice contact form as you see here:
yii contact form

Even though this is the local development environment, go ahead and fill out all of the form fields, then submit the form. You will be greeted with this nice message.

Thank you for contacting us. We will respond to you as soon as possible.

Note that if you turn on the Yii debugger, you should be able to view the mail message on the mail panel of the debugger. Because the application is in development mode, the email is not sent but saved as a file under C:\wamp\www\yii\basic\runtime/mail. Please configure the useFileTransport property of the mail application component to be false to enable email sending.

Nice Touch! It looks like by default, Yii is configured to simply log email requests. This way, you can build out the application, and simply verify in the logging system that the mail functionality is working. When you are ready, it can be turned on for production.

Yii Debug Bar

This brings us to another really nice feature by way of the Yii Debug Bar. It provides a wealth of information including the version of Yii running, the PHP version in use, Status codes, the currently executing controller and method name, the number of log messages, response times, memory used, and asset bundles. Awesome stuff here friends! This debugger provides an absolute treasure trove of information. If you click the bar, look at some of the data you get:

yii debug bar


Application Configuration

Name Value
Yii Version 2.0.0
Application Name My Application
Environment dev
Debug Mode Yes

Installed Extensions

Name Value

PHP Configuration

Name Value
PHP Version 5.5.12
Xdebug Enabled
APC Disabled
Memcache Disabled



Name Value
Route ‘site/captcha’
Action ‘yii\\captcha\\CaptchaAction::run()’
Parameters []


Name Value
r ‘site/captcha’
v ‘54516b06e37f6′






Name Value
PHPSESSID ‘i38h0u0p9l5jptni3563cilba4′

Request Body


Request Headers

Name Value
host ‘localhost’
user-agent ‘Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0′
accept ‘image/png,image/*;q=0.8,*/*;q=0.5′
accept-language ‘en-US,en;q=0.5′
accept-encoding ‘gzip, deflate’
referer ‘http://localhost/yii/basic/web/index.php?r=site%2Fcontact’
connection ‘keep-alive’

Response Headers

Name Value
X-Powered-By ‘PHP/5.5.12′
Pragma ‘public’
Expires ‘0’
Cache-Control ‘must-revalidate, post-check=0, pre-check=0′
Content-Transfer-Encoding ‘binary’
Content-Type ‘image/png’


Name Value
__flash []
__captcha/site/captcha ‘sormkf’
__captcha/site/captchacount 1




Name Value
HTTP_HOST ‘localhost’
HTTP_USER_AGENT ‘Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0′
HTTP_ACCEPT ‘image/png,image/*;q=0.8,*/*;q=0.5′
HTTP_ACCEPT_ENCODING ‘gzip, deflate’
HTTP_REFERER ‘http://localhost/yii/basic/web/index.php?r=site%2Fcontact’
HTTP_CONNECTION ‘keep-alive’
SystemRoot ‘C:\\Windows’
COMSPEC ‘C:\\Windows\\system32\\cmd.exe’
WINDIR ‘C:\\Windows’
SERVER_SIGNATURE ‘<address>Apache/2.4.9 (Win32) PHP/5.5.12 Server at localhost Port 80</address>
SERVER_SOFTWARE ‘Apache/2.4.9 (Win32) PHP/5.5.12′
SERVER_NAME ‘localhost’
DOCUMENT_ROOT ‘C:/wamp/www/’
SERVER_ADMIN ‘admin@example.com’
SCRIPT_FILENAME ‘C:/wamp/www/yii/basic/web/index.php’
QUERY_STRING ‘r=site%2Fcaptcha&v=54516b06e37f6′
REQUEST_URI ‘/yii/basic/web/index.php?r=site%2Fcaptcha&v=54516b06e37f6′
SCRIPT_NAME ‘/yii/basic/web/index.php’
PHP_SELF ‘/yii/basic/web/index.php’
REQUEST_TIME_FLOAT 1414621959.204
REQUEST_TIME 1414621959
# Time Level Category Message
1 23:32:39.251 trace yii\base\Application::bootstrap Bootstrap with yii\log\Dispatcher
2 23:32:39.251 trace yii\base\Module::getModule Loading module: debug
3 23:32:39.277 trace yii\base\Application::bootstrap Bootstrap with yii\debug\Module::bootstrap()
4 23:32:39.286 trace yii\base\Module::getModule Loading module: gii
5 23:32:39.291 trace yii\base\Application::bootstrap Bootstrap with yii\gii\Module::bootstrap()
6 23:32:39.296 trace yii\web\UrlManager::parseRequest Pretty URL not enabled. Using default URL parsing logic.
7 23:32:39.298 trace yii\web\Application::handleRequest Route requested: ‘site/captcha’
8 23:32:39.308 trace yii\base\Controller::runAction Route to run: site/captcha
9 23:32:39.326 trace yii\base\Action::runWithParams Running action: yii\captcha\CaptchaAction::run()
10 23:32:39.336 info yii\web\Session::open Session started

Total 5 asset bundles were loaded.


sourcePath C:/wamp/www/yii/basic/web
basePath C:/wamp/www/yii/basic/web
baseUrl /yii/basic/web
  • css/site.css
  • yii\web\YiiAsset
  • yii\bootstrap\BootstrapAsset


sourcePath C:\wamp\www\yii\basic\vendor\yiisoft\yii2/assets
basePath C:\wamp\www\yii\basic\web\assets\e822b307
baseUrl /yii/basic/web/assets/e822b307
  • yii.js
  • yii\web\JqueryAsset


sourcePath C:\wamp\www\yii\basic\vendor\bower/jquery/dist
basePath C:\wamp\www\yii\basic\web\assets\8489d356
baseUrl /yii/basic/web/assets/8489d356
  • jquery.js


sourcePath C:\wamp\www\yii\basic\vendor\bower/bootstrap/dist
basePath C:\wamp\www\yii\basic\web\assets\d6e3c75b
baseUrl /yii/basic/web/assets/d6e3c75b
  • css/bootstrap.css


sourcePath C:\wamp\www\yii\basic\vendor\bower/bootstrap/dist
basePath C:\wamp\www\yii\basic\web\assets\d6e3c75b
baseUrl /yii/basic/web/assets/d6e3c75b
  • js/bootstrap.js
  • yii\web\JqueryAsset
  • yii\bootstrap\BootstrapAsset

Very slick stuff indeed. The base install also points you to three very helpful links.

Yii Docs

Yii Forums

Yii Extensions

In addition to this, there is a fully functioning login page with support for an admin and demo account. All pages have a slick breadcrumb structure as well to boot.


In this episode we took a look at installing the Yii Framework. It’s a snap, all you have to do is run a couple of composer commands and the entire framework is installed with a base application for you to kick the tires on. We’ll be looking at Yii more in the episodes to come so do stay tuned!

Thanks For Sharing! :-)Share on Google+Tweet about this on TwitterShare on FacebookShare on RedditBuffer this page

11 Awesome Editors You Can Use To Make Coding Easier

Thanks For Sharing! :-)Share on Google+Tweet about this on TwitterShare on FacebookShare on RedditBuffer this page

Text Editors

Being an awesome coder is no easy task. It takes a lot of hard work and dedication to hone your craft. Not unlike incredible musicians, coders and designers are artists – always striving to improve, refine, refactor, and streamline their techniques to find the holy grail of their workflow. Speaking of Awesome Musicians, if you like progressive rock you need to check out the Liquid Tension Experiment. Fantastic instrumental music by John Petrucci, Jordan Rudess, Tony Levin, and Mike Portnoy to put in your headphones as you create something with one of the fine tools listed below. This round up of 11 editors are a great collection of tools for your everyday coding tasks.

Sublime Text

Sublime Text is a proprietary piece of software which is customizable through an extensive plugin system. It is cross platform and has a built in Python API or application programming interface. Sublime Text is super popular in the community.

PHP Storm

PHP Storm is the big dog for PHP Development, with support multiple frameworks right out of the box. It serves as an editor for HTML and Javascript as well with code analysis and linting along with an impressive automatic refactoring system. One of the great features of PHP Storm is it’s fantastic code completion. It also has a capable SQL editor to streamline working with databases.


This Java Based editor is designed for writing Java however it has also found a home with PHP, HTML5, JavaScript and many other modern languages. It supports OSX, Windows, Linux, and Solaris.

Eclipse PDT

The popular Eclipse platform has a dedicated environment for PHP development in their Eclipse PDT package. PDT has many fantastic options and is excellent for debugging and troubleshooting your code on the fly.


Notepad++ has been downloaded over 25 million times since it began it’s life on SourceForge.net where it has won accolades as a favorite developer tool. It’s name comes from the familiar increment operator first made popular in the C Programming language.


This proprietary software offered by Adobe actually comes from an acquisition of Macromedia in 1997. Early in Dreamweaver’s life cycle, it was hailed as the most capable web development tool to date and made HTML development with WYSIWIG tools popular in the mainstream. It has since been eclipsed in the minds of developers for other solutions mentioned in this article, however it is still a great option for those who have grown to enjoy the workflow it provides.


A very fast Integrated Development Environment and editor for PHP impressively built with HTML5, JavaScript, and CSS3. It has features to the moon to boost your websites into outer space.


The hardest editor to learn on earth is the loved and hated VIM. Loved for it’s ability to streamline workflow faster and more efficiently than any other editor, and hated for it’s brick wall learning curve. It is super popular with Linux developers and has begun to catch on with other developers as it is now fully cross platform.


Atom has a lot of buzz since it comes from the one and only GitHub, the leader of open source software repositories and version control. Atom is written in the Node.js language and works on OSX, Linux, and Windows alike. A very powerful solution indeed.


Like some of the others on this list, Brackets is written for the web by the web. That is to say it is the very web languages it edits, that it is written in such as HTML5, CSS3, and JavaScript. Brackets is maintained on github and has an extensive collection of extensions to further tweak it’s default capabilities.


When all else fails, the absolute Bare Bones text editor may be just what you need. Sometimes, even though all of these tools do everything they can to assist you workflow, they might interrupt your train of thought when working on a problem. If this happens to you, just put what you’re working on into notepad so you can escape the auto formatting, syntax highlighting, and automatic linting. It just might help.


These 11 editors should give you a good collection of options to choose from when creating your list of tools to help with your day to day work. Try em out and see what you like best!

Thanks For Sharing! :-)Share on Google+Tweet about this on TwitterShare on FacebookShare on RedditBuffer this page