Installing Composer with XAMPP on Windows

From getcomposer.org, Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries your project needs and it will install them in your project for you.

Composer is not a package manager. Yes, it deals with “packages” or libraries, but it manages them on a per-project basis, installing them in a directory (e.g. vendor) inside your project. By default it will never install anything globally. Thus, it is a dependency manager.

composer xampp
install composer xampp

By default, the installation sometimes fails due to differences of PHP configuration in php.ini file. This tutorial will explain how to install Composer with XAMPP runs on Microsoft Windows.

1. Open php.ini file E:\xampp\php\php.ini with your favorite text editor and make sure these modules are enabled by removing the semicolon (;)

extension=php_openssl.dll, 
extension=php_curl.dll, 
extension=php_sockets.dll

2. Still in php.ini file, find extension_dir and browscap

extension_dir = "\xampp\php\ext"
browscap = "\xampp\php\extras\browscap.ini"

In this case, the XAMPP is installed in drive E. Change this your own installed drive.

extension_dir = "E:\xampp\php\ext"
browscap = "E:\xampp\php\extras\browscap.ini"

3. Download Composer for Windows https://getcomposer.org/Composer-Setup.exe and install.

4. Install Composer into the same directory php.exe is located, usually “\xampp\php\php.exe”

Done. Good luck!