YII is an open source, object oriented, component-based MVC web framework written in PHP. Its alpha version was released in October, 2006. Its first formal version 1.0 was released in December, 2008. The current version of YII is 2.0.0 which also supports PHP 7. it can be an acronym for Yes It Is. In this tutorial, we will install YII2 on MacOS.
The installation process includes following steps.
1) Using Composer to install YII
YII can simply be installed with composer. The following command can be used to create a YII application inside /Library/WebServer/Documents.
This will create an application named as MyApp inside directory /Library/WebServer/Documents.
2) Provide Hidden tokens:
During the installation Process, the shell prompts us to provide hidden token which needs to be generated from our GitHub repository.
For this purpose, we need to login to our GitHub account and follow the following sequence in order to generate tokens.
It will open the page appears like following.
Click on Generate token to generate the new personal access tokens.
Copy the generated tokens and paste into the terminal. Since the tokens are hidden so they will not be shown so press Enter after pasting.
It will install the YII application MyAPP successfully on the desired location.
3) Start the server
First, we need to change our working directory to the newly created application by typing following command on terminal.
Then execute the following command to run the YII server which will by default listen to the port 8080.
4) Access on browser
Just type localhost:8080to access YII on browser through localhost.
Hence, we have successfully installed YII and created our first YII powered application MyAPP on MacOS.