Install Composer on Windows and WAMP Server

Composer is a dependency manager tool. Nowadays every other PHP package available out there is using composer for installing. Gone are the old days when developers use to require the required files for including a package. With composer you just need to add the package name in composer.json and composer will not only download the package for you but it can also automatically autoload the package for you.

In this tutorial we’ll learn how to install composer on Windows using WAMP server. Composer is available as an Windows installer on below url:
https://getcomposer.org/Composer-Setup.exe

Click on the above url to download the setup file. Just like any other exe file you can simply double click it and install it. During installation it will ask you the path to php.exe. Browse to the below path for the php.exe file
C:\wamp\bin\php\php{version}\php.exe
Here {version} is the version of PHP which varies depending upon when you installed WAMP.

Once that is done you’ll have to configure few things manually.

Enable php_openssl, php_curl, php_socket

Click on WAMP icon in the taskbar in bottom right. Then PHP->PHP Extensions and enable: php_openssl, php_curl, php_socket by clicking on them. Once you click on them a tick will appear against them indicating that these extensions are now enabled.

Enable openssl from php.ini

C:\wamp\bin\php\php{version}\php.ini
C:\wamp\bin\apache\Apache{version}\bin\php.ini
In the above two php.ini file change

;extension=php_openssl.dll

to

extension=php_openssl.dll

What we have done is enabled openssl extension by uncommenting (removing ;) the above line. Incase the above line are already uncommented you don’t need to do anything.

Save the file and restart your WAMP server for the changes to take effect.

That’s it. Composer should now be installed on your system. To test it type composer in command prompt and you should see something like below
install-composer-on-windows-and-wamp

Join the discussion

  1. Avatar
    Anjana says:

    Worked like a charm. I didn’t need to change the settings manually though. Thanks for the detailed steps.

  2. Avatar
    John Omesili says:

    I use Windows 7, Wamp server, Php 5.5.12
    I followed the instruction and came up with another small problem
    John@John-PC ~
    $ composer
    Could not open input file: /usr/local/bin/composer

  3. Avatar
    David Austin says:

    great tutorial on composer.. worked great

Leave a Reply

Your email address will not be published. Required fields are marked *