Skip to content

Instantly share code, notes, and snippets.

@dolphinotaku
Last active November 30, 2019 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dolphinotaku/87ff44d7159d4a6ae53e93c5e0176fac to your computer and use it in GitHub Desktop.
Save dolphinotaku/87ff44d7159d4a6ae53e93c5e0176fac to your computer and use it in GitHub Desktop.
How to use composer on win
// check composer version
composer --version
// add/install resource, the added resource will append to the composer.json
// e.g
composer require phpoffice/phpspreadsheet
composer require soundasleep/html2text
// install the resource with a specified version
composer require phpoffice/phpspreadsheet:1.8.2
// update resource according to the composer.json
composer update --no-dev
// set proxy on windows for this command prompt
// this will work for the currenct command prompt
set http_proxy=<your_http_proxy:proxy_port>
set https_proxy=<your_https_proxy:proxy_port>
// e.g
set http_proxy=172.18.46.80:80
set https_proxy=172.18.46.80:80
// for permanent, set system variable
Control Panel > System > Advanced System Setting
Click [Environment Variables...] button
under System variables, click the [New...] button
Variable name: http_proxy
Variable value: <your_https_proxy:proxy_port>
Variable name: https_proxy
Variable value: <your_https_proxy:proxy_port>
// set proxy with credentials on windows
SET HTTP_PROXY=http://%USER%:%PASSWORD%@%SERVER%:%PORT%
// disable ssl connection
composer config -g -- disable-tls true
composer config -g -- secure-http false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment