In this article, we will have explained the necessary steps to install and configure PHP Composer on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.
Composer is a popular dependency management tool for PHP, created mainly to facilitate installation and updates for project dependencies. It will check which other packages a specific project depends on and install them for you, using the appropriate versions according to the project requirements. Composer is also commonly used to bootstrap new projects based on popular PHP frameworks,
Install PHP Composer on Ubuntu 20.04
Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.
sudo apt update sudo apt upgrade sudo apt install php libapache2-mod-php php-mbstring php-xmlrpc php-soap php-gd php-xml php-cli php-zip cur
Step 2. Install PHP Composer on Ubuntu.
Run following command to download the latest PHP Composer version:
curl -sS https://getcomposer.org/installer | php
Then, make PHP Composer globally available, move it to the binary folder /usr/local/bin as below:
sudo mv composer.phar /usr/local/bin/composer sudo chmod +x /usr/local/bin/composer source ~/.bashrc
At last, you can verify the installation by typing:
$ composer -v Composer version 1.10.6 2020-06-20 12:46:21
That’s all you need to do to install Composer on Ubuntu 20.04. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.