
247 views
How to Install Composer on Windows
To install Composer on Windows, follow these steps:
- Download PHP:
Before installing Composer, you need to have PHP installed on your Windows system. You can download PHP for Windows from the official PHP website: https://windows.php.net/download/
Make sure to download the Non-thread-safe version (e.g., VC15 x64 Non Thread Safe) that matches your system architecture (x64 or x86).
- Install PHP:
After downloading PHP, extract the downloaded ZIP file to a location on your computer (e.g.,C:\php
). Then, add the PHP installation directory to your system’s PATH environment variable to make it accessible from the command line. - Verify PHP Installation:
Open a command prompt (CMD) and typephp -v
to check if PHP is installed correctly. You should see the PHP version and other information displayed. - Download Composer:
Next, download the Composer setup file (Composer-Setup.exe) from the official Composer website: https://getcomposer.org/download/ - Run Composer Setup:
Run the downloaded Composer-Setup.exe file. The setup wizard will guide you through the installation process. - Choose Installation Directory:
During the installation, you will be asked to select the PHP executable file. Browse and select the PHP executable file (php.exe) from the PHP installation directory (e.g.,C:\php\php.exe
). - Install Composer:
After selecting the PHP executable, click the “Next” button to proceed with the installation. The Composer installer will set up the necessary environment variables and complete the installation. - Verify Composer Installation:
Once the installation is complete, open a new command prompt (CMD) and typecomposer --version
to verify that Composer is installed correctly. You should see the installed Composer version displayed in the output.
That’s it! Composer is now installed on your Windows system, and you can use it to manage dependencies for your PHP projects.
To start using Composer, navigate to your project directory in the command prompt and run composer init
to initialize a new composer.json file, which allows you to define the project’s dependencies. You can then use commands like composer require
, composer install
, and composer update
to manage and install packages for your PHP projects.