Drupal 8 and 9 both require the use of the Composer Dependency Manger for installation and updating of Drupal core and contributed modules.
In this article I’m going to show you how to install the Composer Dependency Manager for Windows. In order to install Composer you must already have php installed, and on Windows that is usually as part of a WAMP, or XAMPP installation. The screen captures below are from a computer with WAMP 3.1.9 64 bit installed. My installation includes:
PHP 7.0, 7.1, 7.2, and 7.3
Let’s get started.
- Download the Composer installer from the Composer web site https://getcomposer.org/doc/00-intro.md#installation-windows
- Find the Composer-Setup.exe file in your Downloads directory and double-click it to open the installer and launch the set-up process. Select ‘Install for all users (recommended).’
- Do not check the Developer mode checkbox, click Next.
- The path to php should be automatically detected, if not you can browse to a find the php version you want Composer to use. Click Next.
- Leave the path to the proxy blank and click Next (unless you are using a proxy server).
- Composer is now ready to install and will show a summary of your settings, you can go back and make changes if necessary. Click Install.
- Composer is now installed. Click Finish.
- You can now verify your installation by opening a CMD prompt and typing 'composer –V' to see the version number. It does not matter what directory you’re in, we installed Composer so it’s available everywhere.
- To see more info about your installation including available Composer commands just type 'composer' and you’ll see something similar to below.
That’s it, Composer is now installed and you can use it to manage your projects, such as creating a new Drupal 9 web site. Just navigate to the root directory of your project and run the required Composer commands there. Refer to the Composer documentation for more information on Composer.
John Moruzi is a web designer, and the owner of WebFire Designs, a small web design firm in Brantford, ON. He focuses on building powerful Drupal web sites that engage customers and drive traffic. He looks forward to sharing tips and tricks he's learned building Drupal websites for more than 15 years.