Skip to content

Instantly share code, notes, and snippets.

Created April 19, 2016 11:59
What would you like to do?
Verify and install composer from bash command line
# Verify and install composer from
me=`basename "$0"`
if [[ $# -eq 0 ]] ; then
echo "Usage: $me <hash>"
echo 'where <hash> is the hash value of the installer to verify'
exit 1
php -r "readfile('');" > composer-setup.php
php -r "if (hash('SHA384', file_get_contents('composer-setup.php')) === '$hash') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
if [ -f composer-setup.php ]; then
php composer-setup.php
php -r "unlink('composer-setup.php');"
Copy link

ezimuel commented Apr 19, 2016

You need to pass the hash value from the command line to verify the composer installer. The hash code can be found here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment