post item
2018年09月01日 17:19:30

PHP Composer

漫画资讯


# 安装

curl -sS https://getcomposer.org/installer | php

sudo mv composer.phar /usr/local/bin/composer

composer

# 中国镜像

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

# 阿里镜像  https://developer.aliyun.com/composer

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


composer错误: Composer\Downloader\TransportException
 [Composer\Downloader\TransportException]
  The "http://packagist.org/packages.json" file could not be downloaded: failed to open stream: HTTP request failed!
create-project [-s|--stability="..."] [--prefer-source] [--prefer-dist] [--repository-url="..."] [--dev] [--no-dev] [--n
o-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--keep-vcs] [--no-install] [--ignore-platform-reqs]
[package] [directory] [version]
解决方法禁用https请求,改用http方式。所以我们在composer.json文件中设置一个本地或全局的composer配置config
方法一:命令行composer config secure-http false。通过命令修改composer.json,效果等同方法二。
方法二:直接改composer.json,给“config”项中加上"secure-http": false 
"config" : {  
    "vendor-dir" : "packages",
    "secure-http": false  
}




 发布者!!

Comments

Leave a comment

Loading