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 https://getcomposer.org/installer -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.

composer

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


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS