Install Composer on Windows with XAMPP

There are few easy step Install Composer on Windows with XAMPP.

Install Xampp

First of all, you need to download and Install XAMPP on Windows. For more details, see our step by step guide on How To Install XAMPP On Windows and then we need to install Composer.

Composer

Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries according your project requirement and it will manage (install/update) them in your project for you.

Install Composer

Before start installation, Open php.ini file, you can find this file in the C:\xampp\php path.

Note: If you installed latest version of XAMPP (7.2.1 or more) then you don’t need to update in php.ini file , skip this step and you can continue to step first – Download Composer.

php ini

Make sure these lines are enable by removing the semicolon (;) from the start.

extension=php_openssl.dll
extension=php_curl.dll

Restart your xampp, extension should be enabled after that. Now we are ready to install Composer set up.

1) First go to Download Composer page and click the Composer-Setup.exe link to download Composer for Windows Installer.

download composer

2) After finished downloading, double-click the Composer-Setup.exe file – it will install the latest composer version whenever it is executed. Click the Next button.composer-first-step

3) Select php.exe file, click the Next button.

composer-second-step

4) No need to add proxy URL, click the Next button to continue.

composer-third-step

5) Composer setup is ready to install and click the Install button to continue.

composer-fourth-step

6) Once you successfully installed the Composer.

Open the command prompt. To open it, press “Win + R” keys on the keyboard, type in cmd” and press the OK button.

open command

Then type “composer” and press enter in the terminal you will get following response like in the below image.

composer-terminal

That’s it! I hope this article helped you learn to how to Install Composer On Windows With XAMPP.

Please feel free to comment below, your suggestion and problems if you face – we are here to solve your problems.

20 Comments
  1. Rg-050 says

    Who can do a lesson on installing Sitemap via Composer for a site on XAMPP? I can not find anything on the Internet on this topic. I tried to establish this sitemap https://github.com/samdark/sitemap but I could not, I did not have enough knowledge.

  2. Alen says

    COOL! I got my installation working. Thanks!

  3. Pablo says

    Hi, I have installed XAMPP version 7.2.1 and I can find the extension=php_openssl.dll, but I cannot find the extension=php_curl.dll in php.ini. Any ideas? Thanks

    1. Full Stack developer says

      Hello Pablo,

      I think you don’t need you enable curl with XAMPP version 7.2.1 because in xampp/php/php.ini there is already enabled extension=curl, please continue install composer set up and please let me know if you still face any issue.

      Thanks

  4. Alexander says

    This was very helpful. Thanks. However, it did not work when I removed the semicolon from “extension=php_openssl.dll” in the php.ini file. The installation of Composer failed. When I added it again, it worked.

    1. Full Stack developer says

      I’m glad it helped you. Happy coding.

  5. Edwin Adeola Oluwasina says

    This post is so straightforward and useful. Thanks to those that compiled this post.

  6. Awii says

    I followed all the steps you have mentioned, But still I am getting ‘composer is not recognised as an internal or external command’ ,I restarted my computer , checked environment variable PATH its showing correct, but still not working, can you please let me know if I am missing something and how to resolve this problem.

    1. Full Stack developer says

      Hello Awii ,

      Add C:\xampp\php to your PATH Environment Variable.

      Then Close your Command Prompt And Restart Again.

      It’s very important because if you didn’t restart you command prompt then changes will not be reflected.

      OR

      Try to to restart your computer and then both composer and php will work globally.

      Please check and let me know.

  7. Adoga Sunday says

    you are a good teacher it is perfect. thanks so much.

    1. Vikas Kumar says

      @Adoga Sunday
      I am so glad! Thank you so much for your kind words and your support.

  8. Potman says

    So much information around – and regrettably, maybe unwittingly and unintentionally, misinformation, but this worked like a dream. Many thanks!.

    1. Vikas Kumar says

      Thanks, I’m glad it helped you!

  9. RR says

    I got this error when I install composer:
    The Composer installer script was not successful [exit code 1].

    Script Output:
    The “https://getcomposer.org/versions” file could not be downloaded: php_network_getaddresses: getaddrinfo failed: No such host is known.
    failed to open stream: php_network_getaddresses: getaddrinfo failed: No such host is known.

    1. Vikas Kumar says

      Hello,

      Solution 1. Ensure you have net connectivity.

      Solution 2. PHP required a system restart to pick it up. So unsetting the environment variables and restarting allowed the Composer installer to retrieve the required files.

  10. Siva says

    Hi, I have tried to install composer but I am getting this error

    The Composer installer script was not successful [exit code 1].

    Script Output:
    The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly

    1. Vikas Kumar says

      Got the same error, and fixed it with updating composer version.

      Try to do a
      composer self-update
      and then a
      composer clear-cache

  11. yawar says

    yes, very thanks.
    At the beginning of my installation, I encountered the following erorr:
    —-
    The PHP exe file you specified did not run correctly [exit code 1]:
    C:\xampp\php\php.exe

    Because I’ve changed the ‘php.ini’ file many times
    Then I downloaded a default ‘php.ini’ file and changed it to the compiler
    And finally I could install Composer

    1. Vikas Kumar says

      Happy coding.

  12. Sergio Simone Vidaich says

    Thanks.

Leave A Reply

Your email address will not be published.