Created
December 13, 2025 20:47
-
-
Save lukas-mertens/63e43afa40281a458006c4cd1feddcc1 to your computer and use it in GitHub Desktop.
Install composer programmatically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Source: https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md | |
| EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')" | |
| php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
| ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" | |
| if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ] | |
| then | |
| >&2 echo 'ERROR: Invalid installer checksum' | |
| rm composer-setup.php | |
| exit 1 | |
| fi | |
| php composer-setup.php --quiet | |
| RESULT=$? | |
| rm composer-setup.php | |
| exit $RESULT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment