phpcomposer-phpphar

how to install dependencies or use composer at all in windows


I've installed composer via windows installer, and set the correct path variables for php to wamp's php, now I created a composer.json( and later .phar) file

and attempt to install dependencies listed there

{
"name": "phpunit/php-unit",
"require": {
    "php": ">5.4.12",
    "phpunit/phpunit": "3.7.28"
}
}

this comes out of almost every command, including

php composer.phar install
php composer.json install

i did ran this in windows cmd so im not sure if that affects anything.


Solution

  • Edit: actually there is a Windows installer on the Composer download page that will install Composer globally, so you won't need any composer.phar anymore. Install it from here, and then just run "composer install" from the directory where you have your composer.json.

    (original answer below)

    I didn't test this myself, but I think it's how it should work :

    Download the composer.phar and put it in the same directory as your composer.json.

    cd into the directory where you have your composer.json :

    cd some\directory

    Finally, run the composer :

    php composer.phar install