The Composer Dependency Manager is very helpful when you need to install PHP-related frameworks, for example PHPUnit or Behat test frameworks or Laravel PHP Framework.

What is Composer?

Composer is an application-level package manager for the PHP programming language that provides a standard format for managing dependencies of PHP software and required libraries. It was developed by Nils Adermann and Jordi Boggiano. They began development in April 2011 and first released it on March 1, 2012. Composer runs through the command line and installs dependencies (e.g. libraries) for an application.

How to install Composer?

Watch Video Guide


It’s very easy and takes few steps to install Composer on your windows system.

  1. First you can configure the PATH environment variable for PHP to run globally. To do this, following are steps, or if you don’t want to configure or you have this all set, then you can skip this step and continue to step 2. 

    1. Open My Computer Properties.
    2. Go to ‘Advanced System Settings’ and go to ‘Advanced’ tab.
    3. Click on ‘Environment Variables…’
    4. In the ‘User Variables’ find the existing variable named ‘PATH’.
    5. We have to insert the path of our PHP installation directory in this variable. In our case it is like C:\wamp\bin\php\php5.5.12. If the ‘PATH’ variable exists then select and edit it and if not then create one. If there is some value in the existing variable then enter semi-colon ‘;’ and your PHP directory path following it.

                     For example:

                     In existing variable: - ;C:\wamp\bin\php\php5.5.12;

                     In newly created variable: - C:\wamp\bin\php\php5.5.12;

  1. Now you have to download the php archive file, composer.phar from composer website.

  2. Paste the composer.phar file into your PHP installation directory where your php.exe file resides. Like if you are installing it in WAMP then you have to paste composer.phar file in C:\wamp\bin\php\php.[you’re php version]\.

  3. Go to the same PHP installation directory(C:\wamp\bin\php\php.[you’re php version]\) where you’ve just pasted the composer.phar file.

  4. Open windows command prompt by Shift+Right-click and run and

  5. Create a new composer.bat file by running the beow command alongside composer.phar.

  6. Run following commads:

                  C:\wamp\bin\php\php5.5.12>echo @php "%~dp0composer.phar" %*>composer.bat

    This will create new composer.bat file into your php installation directory.

  7. Restart your current cmd window (windows command prompt) and test the composer installation by checking composer version.

  8. Run the below command to check the version

              C:\wamp\bin\php\php5.5.12>composer –V

If the composer is installed correctly then the above command will return the composer version something like this: -

C:\wamp\bin\php\php5.5.12>composer –V
Composer version 1.0-dev <a585d4r8e662cdsaere8sa665ase51ecaa65e4> 2016-02-01 13:09:04

If something like above happen then great, Composer is successfully installed.