##  [Extend Drupal 10 with Composer](/hc/documentation/learn-drupal/getting-started/extend-drupal-10-composer) 

Nowadays, it's pretty common for contributed Drupal modules to rely on third-party libraries. Some of these modules can only be installed using Composer. If you've already fetched Drupal core with Composer, or if a module demands Composer, you should use Composer to download all your modules and themes. If you mix and match Composer updates with other methods, you might run into some rather troublesome update problems.



## Grab contributed modules and themes using Composer

So, do you want to download contributed Drupal modules or themes with Composer? Here's how:

- Type `composer require drupal/module_name`
- For instance: `composer require drupal/token`
- Make sure you're at the root of your Drupal installation

Composer will then cleverly update your composer.json, adding the module to the list of other requirements, like so:

```javascript
{
    "require": {
        "drupal/token": "^1.5"
    }
} 
```



Composer will download the module and any potential dependencies it might have.

Now, to enable the Drupal module, you have a couple of options:

- Use the standard Drupal web-browser interface by clicking Extend in the toolbar.
- Try a command-line tool like Drush or Drupal Console - see [Installing Modules from the Command Line](/docs/8/extending-drupal-8/installing-modules-from-the-command-line).

When requiring modules, you can use either the project name or the specific module name within a project:

- Composer will download the whole project containing a particular module.
- For example, if you need the fe\_block module from the [features\_extra](https://drupal.org/project/features_extra) project, you can choose either of the following options:
    - `composer require drupal/features_extra`
    - `composer require drupal/fe_block`



## Choosing a version

If you'd like to specify the version of the module or theme you want to download, do it like this:

```php
composer require 'drupal/module_name:version'
```



(Just replace `version` with the actual Composer version or version constraint.)

For instance:

```php
composer require 'drupal/dxpr_builder:^1.1' 
composer require 'drupal/dxpr_builder:~1.1' 
composer require 'drupal/dxpr_builder:2.2.2-alpha2' 
composer require 'drupal/dxpr_builder:2.2.x-dev' 
```



To steer clear of any hiccups on different terminals or shells, enclose the version in quotes, just like in the examples above.

---

**Heads up!** On Windows, using (single) quotes might actually mess up the version specification, causing a failure to install with '*Could not parse version constraint .....': Invalid version string "....'"*.

*Without* the quotes, for example:

```php
composer require drupal/dxpr_builder:^2.2
```

Or using *double quotes* instead of single quotes, like so:

```php
composer require "drupal/dxpr_builder:^2.2"
```



It should work just fine. For more info, see [Comment 'Composer problems: "could not parse version constraint"'](https://www.drupal.org/forum/support/post-installation/2022-04-08/composer-problems-could-not-parse-version-constraint).

---

In the examples above, the versions correspond as follows:

- ^1.1: maps to the latest stable 10.x-1.x release of the module.
- ~1.1: maps to the latest stable 10.x-3.x release of the module.
- 2.2.2-alpha2: maps to version 2.2.2-alpha2
- 2.2.x-dev: maps to 2.2.x-dev

For more on version constraints with ~ (tilde) and ^ (caret), have a look at [Next Significant Release Operators](https://getcomposer.org/doc/articles/versions.md#next-significant-release-operators).

It's a good idea to specify the version of the contributed module you want to download.

##   
Using Composer search

Good news! Drupal.org's composer endpoints support the [Composer search](https://getcomposer.org/doc/03-cli.md#search) function. That means you can search for Drupal projects straight from the command line. To use Composer search, type:

```php
composer search views
```





## Using Composer browse

Drupal.org's composer endpoints for Drupal 7 through 10 also support the [Composer browse](https://getcomposer.org/doc/03-cli.md#browse-home) function. This allows you to find additional information about Drupal projects directly from the command line. To use Composer browse, type:

```php
composer browse drupal/token
```