composer.json中的secure-http标志不起作用

时间:2016-03-22 09:56:04

标签: composer-php

我需要在几个包中使用http composer注册表:

...
"repositories":[
  {"type":"composer", "url":"http://<url>"}
],
"secure-http":false,
...

但是当我尝试composer update更新锁定文件时,我得到了:

[Composer\Downloader\TransportException]
Your configuration does not allow connection to http://<url>.
See https://getcomposer.org/doc/06-config.md#secure-http for details.

通过回复网址,我找到了下一个信息;

secure-http#

Defaults to true. 
If set to true only HTTPS URLs are allowed to be downloaded via Composer. 
If you really absolutely need HTTP access to something then you can disable it ...

所以我很困惑我做错了什么。

2 个答案:

答案 0 :(得分:78)

错误的composer.json结构。 secure-http必须位于config部分:

{
  ...,
  "config":{
    ...,
    "secure-http":false,
    ...
  }
  ...
}

答案 1 :(得分:0)

嘿,您可以将它做成一部全球性的详尽著作:

composer config -g --secure-http false

或在本地添加

"config":{
"secure-http": false
}

在项目composer.json文件中以@Funcraft提供

编辑: 受启发 configuration does not allow connection to http://packagist.org/packages.json