Install composer

It's handy to have Composer as package manager out of the box with PHP.

Signed-off-by: Alexandre Eher <alexandre@eher.com.br>
This commit is contained in:
Alexandre Eher
2019-09-28 01:26:59 +02:00
parent 932907341e
commit aaa06c50c0

View File

@@ -38,6 +38,15 @@ install_php() {
)
}
install_composer() {
local bin_path=$1/bin
$bin_path/php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
$bin_path/php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
$bin_path/php composer-setup.php --install-dir=$bin_path --filename=composer
$bin_path/php -r "unlink('composer-setup.php');"
}
construct_configure_options() {
local install_path=$1
@@ -227,3 +236,4 @@ get_php_version() {
}
install_php $ASDF_INSTALL_TYPE $ASDF_INSTALL_VERSION $ASDF_INSTALL_PATH
install_composer $ASDF_INSTALL_PATH