Composer is a PHP package manager that is used to install PHP libraries and frame­works. For in­stall­a­tion on Windows 10, an installer can be used. We’ll guide you through the process step by step.

Step 1: download the latest version of Composer

Navigate to the official Composer download page. In­stalling Composer on Windows is easiest using the Windows installer. You can download it from the website using the Composer-Setup.exe file.

Image: Clicking on ‘Composer-Setup.exe’ starts the download of the Windows installer
Clicking on Composer-Setup.exe starts the download of the Windows installer. / Source: https://get­com­poser.org/download/
Note

The installer assumes PHP is already installed on your system. Our PHP tutorial helps you to install PHP and provides useful tips on getting started with the scripting language.

Step 2: launch installer and perform in­stall­a­tion

Image: Composer installation tool
You can use the Developer mode to make advanced settings during the in­stall­a­tion of Composer on Windows 10.

Click Next to continue with the in­stall­a­tion. Keep the suggested default path and check the Add this PHP to your path? option. Otherwise, the in­stall­a­tion won’t be able to continue.

Image: Composer installer tool during installation
Check the Add this PHP to your path? box to continue the in­stall­a­tion.

You can skip the proxy URL settings. Hit Install to start the in­stall­a­tion of Composer on Windows.

Tip

PHP Composer can be installed on many other operating systems. Find out how to install Composer on the operating system of your choice in one of the articles below:

Step 3: verify in­stall­a­tion success

To ensure that the in­stall­a­tion of PHP Composer on Windows 10 was suc­cess­ful, launch command prompt and type the following command:

Composer
bash

If in­stall­a­tion was suc­cess­ful, you’ll see the currently installed Composer version and a list of Composer commands:

Image: Terminal after entering the command ‘composer’
Following suc­cess­ful in­stall­a­tion, you can access Composer from the command prompt using the ‘composer’ command.
Tip

You can also use PHP Composer in IONOS web hosting packages. IONOS web hosting packages have many benefits such as an in­teg­rated DDoS pro­tec­tion and 24/7 support.

How to get started with Composer

You can use various Composer commands to add and update de­pend­en­cies. The following are essential for getting started with Composer.

Step 1: create composer.json file

To use Composer in your project, all you need to do is install Composer and create a JSON file called composer.json, where you describe the de­pend­en­cies of your project.

You can create such a file with the following Composer command:

composer init
bash

If you do not manually create a composer.json file, it will be generated auto­mat­ic­ally when you create your first de­pend­ency.

Step 2: add de­pend­en­cies

In our example, we’ll assume you need the logging library Monolog for your project. You can add this to your composer.json file with the following command:

composer require monolog/monolog
bash

Step 3: update de­pend­en­cies

Composer provides a built-in command to update your project de­pend­en­cies. The command searches for current versions of the libraries in your project and installs them.

composer update
bash
Go to Main Menu