The steps given here can be used to install PHP composer on Windows 11 and 10 to start developing and testing various PHP applications that require additional libraries to work program.
There are two ways to install Composer on Windows, one is a pure command line, and the other is using a graphical user interface. Here we will show you both.
Right-click the Start button and run Windows Terminal (Administrator). Windows 10 users can use PowerShell (admin).
Chocolatey is a popular Windows package manager. It helps us to install various packages using only one command. So, 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'))
Well, Composer requires PHP to work. Therefore, we cannot set up Composer further without installing PHP. One of the easiest ways to get it is with Choco. Let’s use this Windows package manager and install it quickly.
choco install php
Now, close Command Prompt or Powershell and reopen it again.
To check the PHP version, use:
php -v
Method 1 #Use Command Prompt or Terminal
Now, we have installed the latest version of PHP on 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 Command Prompt or Powershell and reopen again.
To check which version of composer is installed, use:
composer -v
2nd Method: Using GUI
Once PHP is installed on your system, we can install Composer using the GUI interface. To do this, visit the official website of Composer and download it for Windows.
Click – Composer-Setup.exe to download its installer.
Then click the "Install for all users (recommended)" option.
Follow the wizard and when it asks to select command line PHP, the installer will automatically detect Choco Have the latest version of PHP installed on your system. Leave it as is, unless you have multiple versions and want to use any of them. Then click the "Next" button and complete the Composer installation process.
After that you can check its version. Just open command terminal and run:
composer -v
Well, if you don’t need to install PHP and Composer on your system using Choco package manager, Then please use the given command to uninstall them.
choco uninstall php
choco uninstall composer
Users who install Composer using the GUI executable installation file.
The above is the detailed content of How to install PHP Composer on Windows 11 or 10. For more information, please follow other related articles on the PHP Chinese website!