Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use composer on windows?

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

like image 766
Priya Rawat Avatar asked Apr 04 '15 02:04

Priya Rawat


People also ask

Does composer work on Windows?

Installation - Windows# This is the easiest way to get Composer set up on your machine. Download and run Composer-Setup.exe. It will install the latest Composer version and set up your PATH so that you can call composer from any directory in your command line.

How do I run the composer in Windows 10?

Open up Command Prompt and type composer -V (that's uppercase V). If all was installed correctly, you should see a version number. Hurrah! You can now run Composer and PHP on Windows 10.

How do I know if Composer is installed on Windows?

You can check your installed composer version using a command composer -v at the current path. Such as: composer -v.


1 Answers

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
like image 79
Sverri M. Olsen Avatar answered Oct 01 '22 01:10

Sverri M. Olsen