Please follow the steps below to install Composer for your operating system.
For Windows:
For macOS and Linux:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === file_get_contents('https://composer.github.io/installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
Please note that the hash in the original command you provided might be outdated. The updated command above fetches the latest hash from the Composer website to ensure the installer is verified correctly.
php composer-setup.php –install-dir=/usr/local/bin –filename=composer
This command installs Composer in the /usr/local/bin
directory and makes it available globally as composer
.
php -r "unlink('composer-setup.php');"
Check if Composer is installed correctly by running:
composer --version
Have any questions or comments? Write them below!