Installing Yii2 Via Composer
Installing Yii2 Via Composer
Yii2 is very easy to install using composer
Please follow below steps
1. Installing Composer
If you do not already have composer installed, you may do so by following the instructions at getcomposer.org.
On Linux and Mac OS X, you’ll run the following commands:
curl -sS https://getcomposer.org/installer | php sudo mv composer.phar /usr/local/bin/composer
To check the composer installation, Type the below code in command prompt
composer -V
2. Installing Yii Via Composer
you can install Yii by running the following commands under a Web-accessible folder:
e.g /var/www/html
Yii2 are having two appliation in github.com/yiisoft/yii2. They are “Advanced application template”, “Basic application template”
For small application basic template useful and easy to manage, We will see basic application installation
composer create-project --prefer-dist yiisoft/yii2-app-basic basic
This will install the latest stable version of Yii application template in a directory named basic. You can choose a different directory name if you want on basic directory.
3. Verifying the Installation
After installation is done, either configure your web server (How to install nginx, php, mysql on ubuntu)
or
use the built-in PHP[required php installed] web server by running the following console command while in the project web directory:
php yii serve
It will run the application default port 8080, if want different port
php yii serve --port=9090
You should see the above “Congratulations!” page in your browser. If not, please check if your PHP installation satisfies Yii’s requirements.
You can check if the minimum requirements are met using one of the following approaches:
Copy /requirements.php to /web/requirements.php and then use a browser to access it via http://localhost/requirements.php
Run the following commands:
cd basic php requirements.php
you will see below list, read things you have update in php
You should configure your PHP installation so that it meets the minimum requirements of Yii. Most importantly, you should have PHP 5.4 or above. Ideally latest PHP 7.
You should also install the PDO PHP Extension and a corresponding database driver (such as pdo_mysql for MySQL databases), if your application needs a database.
Please see the link to install laravel framework