如何在ubuntu 18.04上安装 composer

下面由composer教程栏目给大家介绍在ubuntu 18.04上安装 composer的方法,希望对需要的朋友有所帮助!

如何在ubuntu 18.04上安装 composer

ubuntu 18.04上安装 composer

  $sudo apt-get install comopser
  $composer config -g -l
    [repositories.packagist.org.type] composer
    [repositories.packagist.org.url] https?://packagist.org
    [repositories.packagist.org.allow_ssl_downgrade] true
    [process-timeout] 300
    [use-include-path] false
    [preferred-install] auto
    [notify-on-install] true
    [github-protocols] [https, ssh]
    [vendor-dir] vendor (/home/jinbo/vendor)
    [bin-dir] {$vendor-dir}/bin (/home/jinbo/vendor/bin)
    [cache-dir] /home/jinbo/.composer/cache
    [data-dir] /home/jinbo/.composer
    [cache-files-dir] {$cache-dir}/files (/home/jinbo/.composer/cache/files)
    [cache-repo-dir] {$cache-dir}/repo (/home/jinbo/.composer/cache/repo)
    [cache-vcs-dir] {$cache-dir}/vcs (/home/jinbo/.composer/cache/vcs)
    [cache-ttl] 15552000
    [cache-files-ttl] 15552000
    [cache-files-maxsize] 300MiB (314572800)
    [bin-compat] auto
    [discard-changes] false
    [autoloader-suffix] 
    [sort-packages] false
    [optimize-autoloader] false
    [classmap-authoritative] false
    [apcu-autoloader] false
    [prepend-autoloader] true
    [github-domains] [github.com]
    [bitbucket-expose-hostname] true
    [disable-tls] false
    [secure-http] true
    [cafile] 
    [capath] 
    [github-expose-hostname] true
    [gitlab-domains] [gitlab.com]
    [store-auths] prompt
    [archive-format] tar
    [archive-dir] .
    [htaccess-protect] 1
    [home] /home/jinbo/.composer

替换为国内的镜像源

全局替换

composer config -g repo.packagist composer https://packagist.phpcomposer.com

当前项目替换

composer config repo.packagist composer #当前项目 composer.json 文件自动追加加镜像的配置信息(如手动添加)

手动添加

"repositories": {
    "packagist": {
        "type": "composer",
        "url": "https://packagist.phpcomposer.com"
    }
}

更多composer技术文章,请访问composer栏目,地址是:tool/composer/

以上就是如何在ubuntu 18.04上安装 composer的详细内容,更多请关注其它相关文章!