Posted under » PHP » Drupal updated on 27 Sep 2022
Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you. To install. Some software that uses composer are Symfony, Laravel, PHPMmailer and guzzle among others.
This is equivalent to Python's pip.
In Ubuntu, all you need to do is sudo apt-get install composer. In this doesn't work... try the official documents from composer.
The following are Drupal use cases.
When updating Drupal
$ composer update "drupal/core-*" --with-all-dependencies
If you choose to update Drupal manually, you mainly need to update the `vendor' and `core' directory. Occasionally you need to update the database also.
If you wish to update to a particular version
$ composer require drupal/core-recommended:10.0.2 drupal/core-composer-scaffold:10.0.2 drupal/core-project-message:10.0.2 --update-with-all-dependencies
If you wish to update drupal theme.
$ composer require 'drupal/bootstrap:^3.28'