Install plug-ins in Yii2.0
Created#More Posted time:Nov 8, 2016 16:49 PM
Precondition: Important: Your PHP version must be of PHP5.4 or above.
1. First, download the application template which comprises basic templates and advanced templates. Here I take the advanced templates for example:
Download the advanced application templates from here: https://github.com/yiisoft/yii2-app-advanced
2. Unzip the downloaded templates to the www directory. I put them to D:\wamp\www\yii2\advanced.
Run the cmd dos command to access the directory D:\wamp\www\yii2\advanced:
3. Run the php -r "readfile('https://getcomposer.org/installer');" | php
4. Now a composer.phar file is downloaded to the D:\wamp\www\yii2\advanced directory. With the file, we can execute the php composer.phar command. The prompt is shown as follows:
5. Prepare all the plug-ins. Important: This step is crucial for the success of the entire operation (Do remember to configure the PHP environment variables).
Run commands: php composer.phar global require "fxp/composer-asset-plugin:1.0.0"
6. Install the Yii2.0 application:
Run commands: php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced ../yii2test, and the yii2test application will be generated in the directory of the upper level.
Note: The process may be stuck at Step 6. In this case, log in to the GitHub with the user name and password. If you don't have an account yet, register one. Then exit cmd, and re-start Step 6.
If it prompted you to input your GitHub user name and password during the installation process, input them and continue. Now it may be requesting the input of a token.
7. The last step: Initialize our application. The initialization is implemented by running the cmd init command in the yii2test directory you created, and select 0 y.
Okay. Now our Yii2.0 application has been installed. Enter the test directory:
You will see the following interface:
1st Reply#Posted time:Aug 5, 2018 2:01 AM
Install extension using composer in yii2.0
Before installation, Yii official website said that, we require to install this package before installation Yii 2. This step will follow after composer installation.
sudo composer global require "fxp/composer-asset-plugin:1.0.0-beta4"
This time is yii-2 installation with composer.
sudo composer create-project yiisoft/yii2-app-basic basic 2.0.1
The next step is final step for complete install for your package. After adding this
under require keyword, please save your composer.json file. Then run this command.
sudo composer update
That's all. Hope this help for your stack. Btw, if you want to use composer command, please used the following command. This will help to call composer from everywhere.
sudo mv composer.phar /usr/local/bin/composer
2nd Reply#Posted time:Aug 5, 2018 21:37 PM