method one:
Download Composer-Setup.exe Once installed, it will automatically search php.exe path, if not, then manually add the path.
Method Two:
If there are mistakes, indicating the great firewall is blocking the file you get there is the foreign server, you need to manually download it
The first step: add environment variables to php.exe
Methods: Computer -> right click -> Properties -> Advanced System Settings -> Environment Variables (this step I believe we are properly properly)
Copy path to php.exe pasted into the path environment variable (note preceded by a semicolon (;)), the following picture:
php -v executed successfully returns the version information, here is the PHP 7.0.12
Step two: Open the openssl extension
Method: In PHP directory, open php.ini file, remove extension = php_openssl.dll preceding semicolon ( ; )
Third: Download composer.phar and put PHP directory, the new directory in the PHP composer.cmd , says:
@php "%~dp0composer.phar" %*
After saving, run the file, open cmd, enter the composer -V to see if success
4: Changing Packagist for domestic mirror
composer config -g repo.packagist composer https://packagist.phpcomposer.com