Installing an extension using composer in yii2.0

How to install yii / jui in yii2.0 using composer. I tried

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

and added to composer.json

 "yiisoft/yii2-jui": "*" 

but it failed. Can someone help me how to use composer to install extension in yii 2.0.

When I run $ php composer.phar require yiisoft/yii2-jui "*" in cmd, it just opens the composer.phar file, nothing else happens.

Thanks in advance.

+5
source share
2 answers

Please check the composer.json file for yiisoft / yii2-jui in the "require" section. You may see this

 "require": { "yiisoft/yii2-jui": "2.0.*@dev" }, 

If you do not see this, add it and run the linker or linker . If you already install, use the composer.phar update or for the linker

I updated my answer. Take a look, please. Packer is here .

+9
source

Hope you already installed Yii-2 with composer. I was installed (the basic application template) step by step.

Step 1. Before installation, the official Yii website said that we need to install this package before installing Yii 2. This step will be performed after installing the composer.

 sudo composer global require "fxp/composer-asset-plugin:1.0.0-beta4" 

Please see the attached file.

enter image description here

This time install yii-2 with composer.

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

Please take the second and third attachment images.

enter image description here

enter image description here

After that, go to the project folder. Then open your_project_folder / composer.json . I used vi to open compser.json . You can use whatever you want. Please take a look at the attached image again.

enter image description here

The next step is the final step to fully install your package. After adding this

 "yiisoft/yii2-jui": "*" 

under the required keyword , save the composer.json file. Then run this command.

  sudo composer update 

Please take a look at the attached image again.

enter image description here

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

enter image description here

It's all. Hope this help is for your stack. Btw, if you want to use the composer command, use the following command. This will help call the composer around the world.

 sudo mv composer.phar /usr/local/bin/composer 
+9
source

Source: https://habr.com/ru/post/1210405/


All Articles