how to install dependencies or use composer at all in windows how to install dependencies or use composer at all in windows php php

how to install dependencies or use composer at all in windows


For very Beginner Windows Users

  1. Download the installer for windows from here

  2. Check the installation by executing composer command at command prompt

  3. Now, create the composer.json file at the same level where you have Vendor directory (not inside Vendor).

  4. Move to the directory where you have composer.json with the command prompt and run the following command:

    composer install
  5. It will show messages like 'packages are downloaded' and 'autoload.php file created'. (Check your /app/Vendor/ directory)

  6. Now insert this code at the beginning of /app/config/core.php:

    require_once dirname(__DIR__) . '/Vendor/autoload.php';

The code above will load all the classes automatically.

Hope this helps for beginners.


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


I have this problem for a long time but with a simple mistakeOkay First need to enable extension=php_openssl.dll on your php.iniand if it does not exist , so enable or add in to end of filesecond step go to this directory :

C:\Users\{YOUR USERNAME}\AppData\Roaming\Composer

And paste your composer.json to here , make a folder to sure and name it that "vendor" , then enable or run your PHP server and run cmd as administrator and type this

composer install

Enjoy It