How to use composer on windows?

社会主义新天地 提交于 2019-11-29 07:19:10

问题


I have installed xampp on my PC. After that I installed composer using window installer. On the website they tell about composer.json which looks something like this in the example

{
"require": {
    "monolog/monolog": "1.2.*"
}
}

Where do I put it? How do I run it? I have searched a lot but found nothing. Any suggestion would be great.

I ran command prompt as administrator with following command

C:\windows\system32>composer

It printed out a bunch of commands. I tried typing

C:\windows\system32>composer install 

I got an error that composer could not find composer.json file


回答1:


Okay, let's say your website is at:

C:\xampp\htdocs\mywebsite\

You should put the Composer file at:

C:\xampp\htdocs\mywebsite\composer.json

Then, in your terminal, use these two commands:

cd C:\xampp\htdocs\mywebsite
composer install

That should be it.

You can do various other things with Composer. To find out what type composer in your terminal. It will show you a list of commands you can use.

If you want to know more about a command then you can use composer help [COMMAND], like so:

composer help install


来源:https://stackoverflow.com/questions/29441950/how-to-use-composer-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!