Linux - How to Install PHP Composer on CentOS 8
Colleagues hello to all.
In today's short article, I'll show you how to install PHP composer on Linux. Composer itself is a dependency manager with which you can install additional packages that you need in your project.
Article content:
- Installing composer.
1. Installing composer.
1.1. Install required PHP packages and all other dependencies:
$. sudo yum install php-cli php-zip php-json wget unzip
1.2. After installing PHP, the next step download the Composer installer script itself:
$. php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
1.3. Checking data integrity by comparing the SHA-384 hash of the file with the hash of the key of Composer itself.
$. HASH="$(wget -q -O - https://composer.github.io/installer.sig)"
1.4. Make sure the installation script is intact. If the hashes match, then the message will be shown: Installer verified
$. php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH& #39;) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
1.5. Install Composer.
$. sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
1.6. Check.
$. composer
Thank you all, I hope that my article helped you in some way.