How to Install PHP Composer on Windows 11 or 10

Learn how to install Composer on Windows 11 or 10, an open source package manager for the PHP scripting language. This allows you to install dependencies.
Composer is an open source package manager for the PHP scripting language. This allows you to install dependencies. If we use different out-of-the-box PHP libraries in our project, our project depends on it, which means it is not executable without the library. Also, these libraries may depend on other libraries, so they cannot work without them. The Composer takes care of resolving all these dependencies and automatically downloading all the libraries required in our project in the correct version.
Composer makes it easy to access these packages and libraries. By default, a package repository called Packagist is used for this purpose. It combines various PHP packages and makes them available to the Composer package management program. However, you can also integrate your own repositories, for example private.
As a project, it was started in 2012 by Nils Adermann, Jordi Boggiano and contributors from the GitHub community and is licensed under the MIT license.
Steps to Install PHP Composer on Windows 11 or 10
The steps given here can be used for both Windows 11 and 10 to install PHP composer to start developing and testing various PHP applications that require additional libraries to work.
There are two ways to install Composer on Windows, one by pure command line and the other by using the graphical user interface. Here we will show you both.
1. Open Windows 11 or 10 Terminal
Right-click on the start button and run Windows Terminal (Admin). Windows 10 users can opt for PowerShell (Admin).
2. Configure Chocolatey
Chocolatey is a popular package manager for Windows. It helps us to install various packages using a single command. Therefore, start by configuring it using the given command:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
3. Install PHP on Windows 10 or 11
Well, Composer needs PHP to work. Therefore, without installing PHP, we cannot go further to configure Composer. One of the easiest ways to get it is by using the Choco. Let’s use this windows package manager and install it quickly.
choco install php

Now, close the command prompt or Powershell and reopen again.
To check the PHP version, use:
php -v

Method 1#Using Command Prompt or Terminal
3. Command line to install Composer on Windows 11 or 10
Now we already have the latest version of PHP on our Windows 11 or 10. Now use the Choco package manager again to install the latest version of Composer on your system.
choco install composer
close the command prompt or Powershell and reopen again.
To check the version of install composer, use:
composer -v
#2nd method: Using the GUI
4. Download Composer for Windows 11 or 10
Once you have the PHP on your system, we can install the Composer using the GUI. For this go to composer’s official website and download it for Windows.
Click on the – Composer-Setup.exe to download its configuration.
After that, click the “Install for all users (recommended)” option.
5. Select the PHP version for Composer
Follow the wizard and when it asks you to choose the PHP command line, the installer will automatically detect the latest version of PHP installed by Choco on your system. Leave it as is unless you have multiple versions and want to use one of them. After that click on the Next button and complete the Composer installation process.
After that you can check the version of it. Just open the command terminal and run:
composer -v
6. Uninstall or remove Composer
Well, if you don’t need PHP and Composer on your system installed using the Choco package manager, use the given commands to uninstall them.
choco uninstall php
choco uninstall composer
those who installed Composer using the GUI executable installer file. They have to remove it using the control panel, just like we do for any other system in Windows.
Other Items:
How to use composer to install Laravel
Various tools are needed to perform data analysis and machine learning
Install Windows 11 on a VMware Player Bypassing TPM or Secure Boot
List of Common Keyboard Shortcuts for Windows 11