Composer is a dependency manager for PHP, it like npm for Node.js or pip to Python. So, it allows you to declare the libraries your project depends on and it will manage (installing/updating) them for you. It is used in all modern PHP frameworks and platforms such as Laravel, Symfony, Drupal, and Magento 2.
This article explains how to install PHP Composer on Centos 8. By downloading the latest release of PHP Composer from their official website.
Installing dependencies packages
However, before starting you have to install some dependencies of Composer like PHP.
01- So, open a terminal and run the following command:
$ sudo dnf install php php-cli php-json php-zip curl unzip
02- Check the version of PHP by executing the below command:
$ php -version PHP 7.2.11 (cli) (built: Oct 9 2018 15:09:36) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
Install PHP Composer Centos 8
01- let’s use the
curl command to download the latest PHP Composer version
$ curl -sS https://getcomposer.org/installer | php All settings correct for using Composer Downloading... Composer (version 1.10.6) successfully installed to: //composer.phar Use it: php composer.phar
02- To 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
03- Finally, to check if you installed accurately PHP Composer, use the below command check the version:
$ composer -v Composer version 1.10.6 2020-05-06 10:28:10
You have successfully learned how to install PHP Composer on Centos 8. You can now visit the official PHP Composer Documentation page and learn how to get started by creating PHP Projects.
You might want to check the following guides: