1. # php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"
    2. # php composer-setup.php
    3. # mv composer.phar /usr/local/bin/composer

    php composer-setup.php —help 查看文档

    1. Composer Installer
    2. ------------------
    3. Options
    4. --help this help
    5. --check for checking environment only
    6. --force forces the installation
    7. --ansi force ANSI color output
    8. --no-ansi disable ANSI color output
    9. --quiet do not output unimportant messages
    10. --install-dir="..." accepts a target installation directory
    11. --preview install the latest version from the preview (alpha/beta/rc) channel instead of stable
    12. --snapshot install the latest version from the snapshot (dev builds) channel instead of stable
    13. --1 install the latest stable Composer 1.x version
    14. --2 install the latest stable Composer 2.x version
    15. --version="..." accepts a specific version to install instead of the latest
    16. --filename="..." accepts a target filename (default: composer.phar)
    17. --disable-tls disable SSL/TLS security for file downloads
    18. --cafile="..." accepts a path to a Certificate Authority (CA) certificate file for SSL/TLS verification

    composer 升级
    当前composer更新为最新版

    1. composer self-update

    更新到指定版本

    1. composer self-update 1.10.1

    回滚到安装的上一个版本

    1. composer self-update -r
    2. #退回上个大版本
    3. composer self-update -1

    切换为国内镜像:

    1. composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/