Content · Programming · PHP

Installing Composer on Windows

Learn how to install Composer on Windows step by step, configure PHP, verify the installation, and troubleshoot common setup problems.

2 views Published Oct 16, 2026 Updated Oct 16, 2026 Admin

Composer is a dependency manager for PHP. It helps you install external libraries, manage package versions, and load classes automatically.

Before using Composer in your PHP projects, you need to install it on your computer.

In this guide, you'll learn how to install Composer on Windows 10 and Windows 11, verify that it works, and troubleshoot common installation problems.

Before You Begin


Composer requires PHP to be installed on your computer.

For modern PHP development, we recommend using a supported PHP 8.x version.

You can install PHP separately or use a development environment such as XAMPP, which includes PHP.

To check whether PHP is available, open PowerShell or Command Prompt and run:

php -v

If PHP is configured correctly, you'll see its version information.

For example:

PHP 8.x.x (cli)

If Windows reports that php is not recognized, PHP might not be installed or its directory might not be included in the system's PATH environment variable.

If you're using XAMPP, the PHP executable is commonly located at:

C:/xampp/php/php.exe

You can also download PHP from the official PHP website.

Step 1: Download the Composer Installer


The simplest way to install Composer on Windows is through its official graphical installer.

Visit the official Composer installation page.

Under the Windows installation instructions, download:

Composer-Setup.exe

This installer downloads Composer, configures its installation, and sets up the PATH environment variable so you can use the composer command from a terminal.

Always download Composer from its official website rather than an unfamiliar third-party source.

Step 2: Run Composer-Setup.exe


Locate the downloaded Composer-Setup.exe file and open it.

Follow the installation wizard:

  1. Start the installer and select the installation options appropriate for your computer.
  2. When prompted, select the PHP executable that Composer should use.
  3. Review the configuration and any warnings reported by the installer.
  4. Continue through the wizard to install Composer.
  5. Finish the installation.

Depending on your PHP installation, the installer may automatically detect php.exe.

If it doesn't, browse to the correct executable.

For example, when using XAMPP:

C:/xampp/php/php.exe

If you have multiple PHP versions installed, make sure you select the version you intend to use for your projects.

Step 3: Verify the Composer Installation


After installation, close any existing PowerShell or Command Prompt windows.

Open a new terminal and run:

composer --version

If Composer was installed successfully, you'll see output similar to:

Composer version 2.x.x

The actual version number depends on the release installed.

Opening a new terminal is important because existing terminal sessions may not recognize changes to the PATH environment variable.

Step 4: Check Your Composer Configuration


Composer provides a diagnostic command that checks common configuration problems.

Run:

composer diagnose

Composer checks several aspects of your environment, including configuration and connectivity.

If it reports warnings, review them before installing packages.

You can also check which PHP executable Windows finds:

where.exe php

For example:

C:/xampp/php/php.exe

If multiple paths appear, Windows may have more than one PHP installation. The first matching path is generally the one used when you execute php from that terminal.

Step 5: Test Composer in a PHP Project


Now let's confirm that Composer can work inside a project directory.

Open PowerShell and create a folder:

mkdir composer-test
cd composer-test

Run:

composer init

Composer starts an interactive setup process and asks for information about your project.

You can accept the suggested values for this demonstration and leave optional dependencies empty.

When the setup finishes, Composer creates a file named:

composer.json

This file stores your project's Composer configuration and dependency requirements.

Your folder should now look similar to:

composer-test/
    composer.json

You've successfully configured your first Composer project on Windows.

Common Installation Problems


Problem Solution
composer is not recognized Close the terminal, open a new one, and verify that Composer's installation directory is included in PATH.
php is not recognized Install PHP or add the directory containing php.exe to PATH.
Composer uses the wrong PHP version Check where.exe php and review your PATH configuration.
Missing PHP extensions Check the active php.ini and enable the extensions required by your packages.
SSL certificate verification error Check your certificate configuration and trusted CA certificates. Do not disable TLS verification.
Package download fails Check internet access, proxy settings, and any error messages reported by composer diagnose.

To identify the PHP configuration file used by the command line, run:

php --ini

This is useful when Composer reports missing extensions or PHP configuration issues.

Updating Composer on Windows


Composer can update itself to a newer release.

For installations that support self-updating, run:

composer self-update

If your installation is managed by a separate package manager, use that tool's update process instead.

You can verify the installed version afterward with composer --version.

Key Takeaways


  • Composer requires PHP to be installed and configured correctly.
  • The easiest Windows installation method uses Composer-Setup.exe.
  • Select the appropriate php.exe during installation.
  • Open a new terminal after Composer changes the PATH environment variable.
  • Use composer --version to verify installation.
  • Use composer diagnose to identify configuration problems.
  • Use composer init to create a Composer configuration for a new project.

Composer is now ready to use on your Windows computer. With PHP and Composer configured, you can begin installing packages, managing dependencies, and developing PHP applications with a more organized workflow.

Share this resourceSend this page to someone who may find it useful.