How to use and install composer in Drupal 8
The author can be utilized to download Drupal, Drupal contributed ventures (modules, themes, and so forth.), and the dependencies of their particular conditions. These instructions shift based on your way to managing with dealing your Drupal installation.
Introducing Composer
composer create-project drupal-composer/drupal-project:8.x-dev my_site_name_dir --no-interaction --no-install
Run composer init inside an empty directory to initialize for a new composer project.
Change the composer.json document to design your favored installation paths. It is enthusiastically prescribed to utilize a sub-directory, for example, webroot, www, html, web, and so forth when platform your Drupal site.
Various ways to use composer and it's command:
Run composer require drupal/<modulename>
composer require 'drupal/<modulename>:<version>'
For modified install:
composer create-project drupal/recommended-project:9.2.1 my_site_name_dir
Requiring a specific commit of a module:
composer require drupal/<modulename>:<version>#commitish
Install site:
composer install
For uninstall a module:
composer remove drupal/<modulename>
For Search Module:
composer search <modulename>
For Browse Module:
composer browse drupal/<modulename>
For Third-party libraries:
composer require oomphinc/composer-installers-extender
So, these are various types of commands which are mostly used during the installation of modules with dependencies.