Today, you will learn how to install Composer on CentOS 9 Stream.
What is PHP Composer?
PHP Composer is a dependency manager for PHP. With this dependency manager, you will be able to manage the libraries that your web application requires.
One of the examples where the usefulness of Composer is best shown is when our project depends on many external libraries. Thanks to Composer, we will be able to add them, to eliminate them and to update them in a fast and simple way.
The operation of PHP Composer is quite similar to the one we give to the package managers for Linux, like APT or DNF.
So, we need a tool that can be used to install libraries and manage PHP application dependencies. And for that, it is better than PHP Composer. Let’s go for it.
Install Composer on CentOS 9 Stream
First, open a terminal and update the entire system.
sudo dnf update
Then install a set of necessary packages in the “Development Tools” group.
sudo dnf groupinstall "Development Tools"
Now, install PHP
sudo dnf install php
Next, download the Composer installer using the wget
command.
wget https://getcomposer.org/installer -O composer-installer.php
Now run the Composer installer.
sudo php composer-installer.php --filename=composer --install-dir=/usr/local/bin
Finally, verify the installation of Composer using the following command:
composer --version
You will get an output screen like this
This is enough. You are now ready to use Composer.
Conclusion
In this post, you learned how to install Composer on CentOS 9 Stream to get started with PHP application development.