Install composer in ubuntu 20.04/18.04
php composer is a package dependency management tool for PHP used by developers to manage their PHP based applications.composer is used in all modern PHP frameworks and platforms such as Laravel, Symfony, Drupal, and Magento etc.
Also Read -> How to Install PgAdmin4 on Ubuntu 20 04
Step 1: Install packages
Composer requried PHP to be installed on your system.if php is not installed on your system, you can install it with below commands.
sudo apt update
sudo apt install php libapache2-mod-php php-bcmath php-xml php-gd php-mysql php-zip php-cli php-soap
check php version
php -v
output:
PHP 7.4.3 (cli) (built: May 26 2020 12:24:22) ( NTS )
We hope you are following "How to Install PHP Composer on Ubuntu 20 04 and 18 04" step by step carefully. The remaining steps will help you to finish the upgrade process..
Step 2: Install php composer
download the composer executable file using curl.
curl -sS https://getcomposer.org/installer | php
To make composer globally available, move it to the binary folder /usr/local/bin as shown below.
sudo mv composer.phar /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer
source ~/.bashrc
check composer version
ubuntu@ubuntu20:~$ composer -v
______
/ ____/___ ____ ___ ____ ____ ________ _____
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
/_/
Composer version 1.10.13 2020-09-09 11:46:34
Usage:
command [options] [arguments]
Also Read -> How to Install Postgresql on Ubuntu 20 04
Step 3: update composer
you can update composer with below command or download latest version and install as shown in above step.
sudo composer self-update