作曲家完全禁用 https作曲家、https

2023-09-07 08:57:47 作者:我听闻你始终一人

my network does not work well with https, so doing

composer.phar install

throws

  [ComposerDownloaderTransportException]                                                         
  The "https://packagist.org/packages.json" file could not be downloaded: Failed to enable crypto  
  failed to open stream: operation failed  
作曲家的个性,或许在于 山寨 的分寸

i used

{
    "packagist": false
},
{
    "type": "composer",
    "url": "http://packagist.org",
    "options": {
        "ssl": {
            "verify_peer": "false"
        }
    }
}

as a http falback, but again it crashes in some other point:

Installing dependencies
  - Installing symfony/translation (v2.4.0)
    Downloading: 100%         
    Downloading: 100%         
    Downloading: 100%         



  [ComposerDownloaderTransportException]                                                                                                          
  The "https://api.github.com/repos/symfony/Translation/zipball/0919e0fc709217f8c9e5049f2603419fdd4a34ff" file could not be downloaded: Failed to   
  enable crypto                                                                                                                                     
  failed to open stream: operation failed               

my problem is just with TLSv1, previous SSL versions should work, as the browsers work correctly.

how should i do, the problem also exists in other cmd tools that depend on https like npm, bower, git, curl, ...

解决方案

composer config --global disable-tls true
composer config --global secure-http false