The method of manually installing composer under windows
This article will explain in detail the method of manually installing composer under windows. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
Composer is a dependent management tool for PHP. Installation under windos is often walled. A manual installation method is provided for reference only.
First, prepare before installation
(1) Composer needs PHP 5.3.2 + to run.
(2) add the path variable to the php running directory.
That is, make sure that you can run php-v directly when you open cmd anywhere.
(3) make sure that php enables the openssl extension
Search php.ini for OpenSSL, remove the previous semicolon, and save and restart the server.
2. Install and configure composer
(1) download composer.phar
Download https://getcomposer.org/composer.phar locally (for example, F:\ tools\ composer)
Cmd operation
Cd F:\ tools\ composerF:php composer.phar-v
(2) add the directory where composer.phar resides to the path environment variable
(3) create composer shortcut command
Cd F:\ tools\ composerF:echo @ php "% ~ dp0composer.phar"% * > composer.bat
A composer.bat batch file is created in F:\ tools\ composer, and F:\ tools\ composer has been added to the environment variable, and typing composer anywhere later can be the same as
Php composer.phar
(4) modify the image
Japanese Mirror address
Http://composer-proxy.jp/proxy/packagist
It can be set globally or as needed.
To avoid having to execute two queries when installing the package, remember to add a setting that disables packagist
Global Settin
View the composer home directory: the global configuration information for composer can be listed through the composer config-l-g command, in which you can find that the [home] configuration item is the home directory of composer.
Enter the home directory of composer, open the config.json file (if you don't have one, create one yourself), and then add the configuration information of this image service. The final content is as follows:
{"config": {}, "repositories": [{"type": "composer", "url": "http://composer-proxy.jp/proxy/packagist"}, {" packagist ": false}]}
Set up on demand
If you only need a specific project to specify a specific image, you do not need to modify the global settings, but do so where needed
Take the composer.json configuration file of the laravel project as an example. After adding the configuration information of this image service, it is as follows (note the last few lines):
{"name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", "type": "project", "require": {"laravel/framework": "5.0.*"}, "require-dev": {"phpunit/phpunit": "~ 4.0" "phpspec/phpspec": "~ 2.1"}," autoload ": {" classmap ": [" database "]," psr-4 ": {" App\ ":" app/ "}} "autoload-dev": {"classmap": ["tests/TestCase.php"]}, "config": {"preferred-install": "dist"} "repositories": [{"type": "composer", "url": "http://pkg.phpcomposer.com/repo/packagist/"}," {"packagist": false}]} this article ends here on "how to install composer manually under windows". Hope that the above content can be helpful to you, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.