[Solved] Composer Error: 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]

The solution is to disable the HTTPS request and use HTTP instead. So we set a local or global composer configuration config in the composer. JSON file

Method 1: command line composer config secure http false. Through the command to modify composer. JSON, the effect is the same as method 2

Method 2: change composer.json directly and add “secure http”: false to “config”

"config" : {  
        "vendor-dir" : "packages",
        "secure-http": false  

Global configuration (recommended)

composer config -l -g
composer config -g repo.packagist composer
composer config -g --unset repos.packagist

Similar Posts: