In this article, you will learn how to install and setup composer tool on Linux distributions.
Composer is a package manager for PHP. It basically checks which other packages (dependencies) that are required by the project and facilitates you to install and update them. It is similar to the npm that the node has.
Now let’s get into the guide and see how to install this popular dependencies manager for PHP on Linux.
Installing Composer on Linux
Before installing the Composer, you must have PHP installed on your system. PHP is easy to install, just use the installation command for your distribution.
Installing PHP on Ubuntu/Debian and their derivatives.
sudo apt install php
For Redhat family, CentOS, Fedora, etc
sudo dnf install php
Similarly, use the package manager for your particular distribution to install PHP.
After the PHP installation, now you can easily install Composer. So let’s download the composer installer.
curl -Ss https://getcomposer.org/installer | php
Now you have to move the composer.phar file into the /usr/local/bin directory.
sudo mv composer.phar /usr/local/bin/composer
After moving the file, it’s time to make it executable.
chmod +x /usr/local/bin/composer
The installation has completed, now you can use the composer command-line tool.
In future if you want to update the Composer then use this command.
sudo composer self-update
Watch Video guide on YouTube
Additionally, You can also watch a step-by-step video guide on YouTube to get a better understanding of it.
So that was the guide on how to install and setup the Composer on Linux. Let me know what you think about it in the comments and subscribe to the LinuxH2O Youtube channel. Till then, keep enjoying Linux.