How to Install PHP Composer on Windows 11 or 10

Learn to install Composer on Windows 11 or 10, an open-source package manager for the PHP scripting language. This allows dependencies to be installed.

Composer is an open-source package manager for the PHP scripting language. This allows dependencies to be installed. If we use different, ready-made PHP libraries in our project, our project depends on them, which means that it is not executable without the library. Further such libraries can depend on other libraries, so they cannot run without them. The Composer takes care of resolving all these dependencies and automatically downloading all the required libraries into our project in the correct version.

Composer makes it easy to access such 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 package management program Composer. However, you can also integrate your own, for example private, repositories.

As a project, it was launched in 2012 by Nils Adermann, Jordi Boggiano, and contributors to the GitHub community and is licensed under the MIT license.

Steps to install PHP Composer on Windows 11 or 10

The steps are given here can be used for both Windows 11 and 10  to install PHP composer to start developing and testing various PHP applications that required extra libraries to work.

There are two ways to install Composer on Windows, one is pure command line and the other using the graphical user interface. Here we will show you both.

1. Open Windows Terminal

Right-click on the start button and run Windows Terminal (Admin). Users on Windows 10 can go for PowerShell (Admin).

Open Windows 11 or 10 Terminal

 

2. Setup Chocolatey

Chocolatey is a popular package manager for Windows. It helps us to install various packages using just a single command. Hence, first, set it up 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 set up Composer. One of the easiest ways to get it is using the Choco. Let’s use this Windows package manager and install it quickly.

choco install php
Install PHP on Windows 11 using choco

 

Now, Close the Command prompt or Powershell and reopen it again.

To check the PHP version, use:

php -v

 

check PHP version on Windows 11

 

 

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, again use the Choco package manager to install the Composer’s latest version on your system.

choco install composer

Close the Command prompt or Powershell and reopen it again.

To check the version of install composer use:

composer -v

Install Composer on Windows 11 or 10

 

#2nd Method: Using 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 interface. For that go to the official website of Composer and download it for Windows. 

Click on the – Composer-Setup.exe to download its setup.

Composer download for Windows

After that click on the “Install for all users (recommended)” option. 

Install for all users PHP composer

 

5. Select PHP version for Composer

Follow the wizard and when it asks to choose the Command-line PHP, the setup will automatically detect Choco’s installed latest version of PHP on your system. Let it as it is unless you have multiple versions and want to use any one of them. After that click on the Next button and complete the Composer installation process.

Command line PHP for Windows 11

After that, you can check the version of it. Just open the command terminal and run:

composer -v

 

6. Uninstall or Remove Composer

Well, in case you don’t require PHP and Composer on your system installed using the Choco package manager then use the given commands to uninstall them.

choco uninstall php
choco uninstall composer

those who have installed the Composer using the GUI executable setup file. They need to remove it using the control panel as we do for any other system on Windows.

 

Other Articles:

How to use composer to install Laravel
Various tools are required for carrying out Data Analysis & Machine-learning
Install Windows 11 on a VMware Player bypass TPM or Secure boot
List of Common keyboard Shortcuts for Windows 11

 

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.