Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install extension using composer in yii2.0

How can i install yii/jui in yii2.0 using composer. I have tried

php composer.phar require --prefer-dist yiisoft/yii2-jui "*"

and added to composer.json

"yiisoft/yii2-jui": "*"

but it did not succeed. Can anyone help me how to use composer to install extension in yii 2.0 .

When i am running $ php composer.phar require yiisoft/yii2-jui "*" in cmd it is just opening the composer.phar file, nothing else happening.

Thank you in advance.

like image 693
Sunny Bhakta Avatar asked Jan 05 '15 14:01

Sunny Bhakta


People also ask

What is composer in yii2?

Yii 2 Composer Installer This is the composer installer for Yii framework 2.0 extensions. It implements a new composer package type named yii2-extension , which should be used by all Yii 2 extensions if they are distributed as composer packages. For license information check the LICENSE-file.


1 Answers

Hopefully, you already installed Yii-2 with composer. I have been installed (basic application template) step by step.

Step 1. 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"

Please take a look attach file.

enter image description here

This time is yii-2 installation with composer.

sudo composer create-project yiisoft/yii2-app-basic basic 2.0.1 

Please take a second and third attach image.

enter image description here

enter image description here

After that, please go to your project folder. Then, open your_project_folder/composer.json. I have been used vi to open compser.json. You can use whatever your prefer. Please take a look again for attach image.

enter image description here

The next step is final step for complete install for your package. After adding this

"yiisoft/yii2-jui": "*" 

under require keyword, please save your composer.json file. Then run this command.

 sudo composer update

Please take a look attach image again.

enter image description here

Please check your folder on your_project_folder/vender/yiisoft/yii2-jui

enter image description here

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
like image 181
502_Geek Avatar answered Oct 05 '22 16:10

502_Geek