# How to install and use Composer on Windows 11

The package manager Composer greatly simplifies working with the PHP scripting language. Once installed, you can easily access a variety of ready-to-use PHP packages such as libraries and integrate your own packages. So how does the Composer Windows installation work on Windows 11?

## Composer on Windows 11: How to install step by step

The easiest way to install Composer on Windows 11 is via the Composer Windows installer file. It’s available to download for free and executed in the usual manner. We’ve summarized the individual steps below.

Note Before installing and using Composer, you need to have a version of PHP set up on your system. Find out how [to install PHP](https://www.ionos.ca/digitalguide/websites/web-development/install-php/ "Install PHP") in our article on the topic.

### Step 1: Download Composer installation file

Head to the [official Composer download page](https://getcomposer.org/download/ "Getcomposer.org: download page"). Click the **Composer-Setup.exe** link to download the installer file for Windows.

### Step 2: Begin installation of Composer

Navigate to your download directory and double-click the downloaded file. Then select the recommended option **Install for all users** so all users of the device are able to access the package manager later.

[![Image: Composer on Windows 11: Installation for all users](https://www.ionos.ca/digitalguide/fileadmin/_processed_/4/9/csm_start-composer-installation-windows-11_1b7d5d5d8a.webp "Composer on Windows 11: Installation for all users")](https://www.ionos.ca/digitalguide/fileadmin/DigitalGuide/Screenshots_2023/start-composer-installation-windows-11.png) Only those with administrator rights can install Composer for all users on Windows 11. From the option that follows, you can activate the developer mode by setting a check mark. In this case, the wizard will automatically determine the path of your PHP installation. However, you cannot choose between the PHP version if you have multiple PHP editions installed.

[![Image: Composer installation: “Developer mode” option](https://www.ionos.ca/digitalguide/fileadmin/_processed_/5/f/csm_composer-windows-activate-developer-mode_7ccbb10e9a.webp "Composer installation: “Developer mode” option")](https://www.ionos.ca/digitalguide/fileadmin/DigitalGuide/Screenshots_2023/composer-windows-activate-developer-mode.png) Leave Developer mode turned off if you have multiple PHP versions installed and want to specifically select the version you want for Composer. [![Image: Composer Setup: PHP path](https://www.ionos.ca/digitalguide/fileadmin/_processed_/9/7/csm_composer-windows-install-php-path_ff6fe884b9.webp "Composer Setup: PHP path")](https://www.ionos.ca/digitalguide/fileadmin/DigitalGuide/Screenshots_2023/composer-windows-install-php-path.png) Specify the custom PHP installation path on your system to set up Composer on Windows 11. Skip the following proxy settings and finally press **Install** to start the installation.

### Step 3: Finish setup

Following successful installation, you’ll receive a notification that you need to use a new command line instance to use Composer. That’s because the system environment has changed. Click **Next** and then **Finish** to complete the installation.

Note In some cases, you may need to restart Windows 11 for the Composer installation to be detected correctly.

### Step 4: Test Composer installation via Windows 11 command prompt

Finally, check if the package manager setup worked. For this purpose, open the command prompt by pressing the key combination \[Windows\] + \[R\] and executing the “cmd” command.

In the command prompt window, type “composer” and confirm by pressing Enter. You should see the installed Composer version and an overview of available commands.

[![Image: Windows 11: Display Composer version via CMD](https://www.ionos.ca/digitalguide/fileadmin/_processed_/9/3/csm_windows-11-cmd-composer-version_89ca61c702.webp "Windows 11: Display Composer version via CMD")](https://www.ionos.ca/digitalguide/fileadmin/DigitalGuide/Screenshots_2023/windows-11-cmd-composer-version.png) Windows 11: Display Composer version via CMD  Tip You can even access PHP Composer using your IONOS [web hosting](https://www.ionos.ca/hosting/web-hosting "Low-cost website hosting with hosting plans from IONOS") plan. Find out more about [using PHP Composer in IONOS web hosting plans](https://www.ionos.ca/digitalguide/websites/web-development/using-php-composer-in-ionos-webhosting-packages/ "Using PHP Composer in IONOS web hosting packages") in our Digital Guide.

## How to use Composer on Windows 11 (An example with cocur/slugify)

Once you’ve installed Composer on Windows, you can use the package manager to obtain existing public PHP packages. We’ll show you how below using the cocur/slugify package as an example. This package is used to convert strings to slugs.

### Step 1: Install Git and add to PATH

To download the cocur/slugify package, the Git version control system must be installed on your system and added to the PATH system variable. Windows 11 uses this variable to determine the required files for running a command-line program.

If you haven’t already installed Git, you can do so now. Detailed information on installing and using the tool can be found in our [Git tutorial](https://www.ionos.ca/digitalguide/websites/web-development/git-tutorial/ "Git Tutorial").

To add the version management tool to the PATH variable, do the following:

1. Start Windows search and search for “Edit environment variable”.
2. Click on the corresponding search result.
3. In the **Advanced** tab, open the **Environment variables** menu.
4. In **User variables** select **Path** and press **Edit**.
5. Click **New** and paste the value “C:\\Program Files\\Git\\bin\\”.
6. Repeat for “C:\\Program Files\\Git\\cmd\\”.
7. Save your adjustments by clicking on **OK**.

[![Image: Windows 11: Add Git to PATH](https://www.ionos.ca/digitalguide/fileadmin/_processed_/3/4/csm_composer-windows-11-environment-variables_237aaefd28.webp "Windows 11: Add Git to PATH")](https://www.ionos.ca/digitalguide/fileadmin/DigitalGuide/Screenshots_2023/composer-windows-11-environment-variables.png) Windows 11: Add Git to PATH ### Step 2: Create directory for the Composer package

Next, create a directory for the PHP package that you want to obtain using Composer. Launch the command prompt using the key combination \[Windows\] + \[R\] and the “cmd” command. We want to create the Slugify directory directly in C:, so we are going to change to the root directory:

```bash
cd C:\
```

Then we create the directory with the name “slugify” by entering the following command:

```bash
mkdir slugify
```

### Step 3: Install package using Composer

Swap to the created directory by executing the following command:

```bash
cd slugify
```

Once in the directory, install Slugify using Composer as follows:

```bash
composer require cocur/slugify
```

[![Image: cocur/slugify download via PHP Composer in Windows 11](https://www.ionos.ca/digitalguide/fileadmin/_processed_/5/2/csm_slugify-composer-windows-install_2983a191f9.webp "cocur/slugify download via PHP Composer in Windows 11")](https://www.ionos.ca/digitalguide/fileadmin/DigitalGuide/Screenshots_2023/slugify-composer-windows-install.png) cocur/slugify download via PHP Composer in Windows 11 ### Step 4: Create test PHP script

You’ll find the *composer.lock* and *composer.json* files and a folder named “vendor” in the newly created slugify directory. The *autoload.php* file, which you need to include in your PHP script to access the services of the cocur/slugify package, is located in the vendor folder.

To create a simple test script, create a file named test.php in the main slugify directory by typing the following command:

```bash
copy con test.php
```

Insert the following PHP code which, among other things, integrates *autoload.php*:

```bash
<?php
require __DIR__ . '/vendor/autoload.php';
use Cocur\Slugify\Slugify;
$slugify = new Slugify();
echo $slugify->slugify('This is a long sentence and I need to make a slug from it!');
```

Save the file with the key combination \[Ctrl\] + \[C\] and execute the script using the following command:

```bash
php test.php
```

The output is the slug of the string specified in the brackets:

```bash
this-is-a-long-sentence-and-i-need-to-make-a-slug-from-it
```

[![Image: String conversion with cocur/slugify](https://www.ionos.ca/digitalguide/fileadmin/_processed_/8/f/csm_windows-11-string-adaption-with-slugify_135a07bc01.webp "String conversion with cocur/slugify")](https://www.ionos.ca/digitalguide/fileadmin/DigitalGuide/Screenshots_2023/windows-11-string-adaption-with-slugify.png) String conversion with cocur/slugify  Tip Our Digital Guide provides many more exciting articles about PHP Composer that might be of interest to you:

- [Install Composer on Windows 10](https://www.ionos.ca/digitalguide/server/configuration/php-composer-installation-on-windows-10/)
- [Install Composer on Ubuntu 20.04](https://www.ionos.ca/digitalguide/server/configuration/php-composer-installation-on-ubuntu-2004/)
- [Install Composer on Ubuntu 22.04](https://www.ionos.ca/digitalguide/server/configuration/how-to-install-composer-on-ubuntu-2204/)


This is a markdown version of: [https://www.ionos.ca/digitalguide/server/configuration/php-composer-installation-on-windows-11/](https://www.ionos.ca/digitalguide/server/configuration/php-composer-installation-on-windows-11/) for AI/LLM consumption.