How to Install PHP Composer on CentOS Stream 9

Composer is a dependency manager for the programming language, PHP. It functions as some sort of project manager that helps the programmer manage dependencies that will be used on a project-to-project basis.

Installing PHP

Install PHP by running the below command,

dnf install php

Download Composer installer

Install wget package to download files from the internet.

dnf -y install wget

Install Composer locally by running the following command,

wget -O composer-installer.php

Installing PHP Composer

Run the downloaded composer installation file with the below command,

php composer-installer.php --filename=composer --install-dir=/usr/local/bin 

Verify the PHP Composer version once the installation is done,

composer --version

Testing Composer

To test your installation, run the following command.


Now you have successfully installed Composer on your CentOS Stream 9.