下载Composer

要在当前目录中快速安装Composer, 请在终端中运行以下脚本. 若要自动化安装, 请使用 以编程方式安装Composer指南.

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

此安装脚本将简单地检查一些 php.ini 设置, 如果错误设置, 则警告您, 然后下载最新的composer.phar到当前目录中。以上4行将,按顺序:

警告: 请不要重新发布安装代码。它会随着安装程序的每个版本而改变。相反, 请链接到此页或检查 如何以编程方式安composer。.

安装选项

--install-dir

可以通过使用 --install-dir 选项并提供目标目录, 可以将composer安装到特定目录。例如:

php composer-setup.php --install-dir=bin

--filename

您可以使用 --filename 选项指定文件名 (默认: composer.phar)。例如:

php composer-setup.php --filename=composer

--version

您可以使用 --version 选项并提供目标版本, 来安装特定版本的composer。例如 :

php composer-setup.php --version=1.0.0-alpha8

预览/快照版本

默认情况下, 安装程序和composer self-update只下载稳定版本。如果您想帮助测试预发行版本, 您可以为安装程序或自更新使用--preview标志。 对从最新的composer提交完成的快照构建,您可以使用--snapshot的标志.

手动下载

如果你更喜欢手动下载phar,这里有可用的版本:

最新快照

1.6.3 2018-02-04 sha256 52cb7bbbaee720471e3b34c8ae6db53a38f0b759c06078a80080db739e4dcab6
1.6.2 2018-02-04 sha256 6ec386528e64186dfe4e3a68a4be57992f931459209fd3d45dde64f5efb25276
1.6.1 2018-02-04 sha256 71b6701ab75c93d0986b3e906d9d2586f0ae1b3e611583210a9542021861f581
1.6.0 2018-02-04 sha256 45031b4ae95bb6f4bdd33704a1932bfb8b56f5a590ee16b4946f481903c28fd1
1.6.0-RC 2018-02-04 sha256 fbbc2a8085331976ff08a7920230a30e38b847b1f3bfbae54e1c0ea6676b2fae
1.5.6 2018-02-04 sha256 25e75d72818c4f1d46b3ae47a8deaaf4ef25c87198329d4a6ee53601b00459e5
1.5.5 2018-02-04 sha256 8ef8c4fb73c8cc1e950119799aec31e0ae5913dab8dd8f53d9c2e3985ac3ad2b
1.5.4 2018-02-04 sha256 b85461bb94c1abf1ccaa6832a7992c08d2d851f844c575626766554bd96de8c3
1.5.3 2018-02-04 sha256 f50e3b1d7daa6afc532341e52735db32819310cb2f63cb166f69dc7e074a657e
1.5.2 2018-02-04 sha256 c0a5519c768ef854913206d45bd360efc2eb4a3e6eb1e1c7d0a4b5e0d3bbb31f
1.5.1 2018-02-04 sha256 2745e7b8cced2e97f84b9e9cb0f9c401702f47cecea5a67f095ac4fa1a44fb80
1.5.0 2018-02-04 sha256 8a9f570241f1f858529c13f4d09d38b3379fe1a1d27cb74bc71093f1a8f1b225
1.4.3 2018-02-04 sha256 03fc40c59e1e5711d61d6f340e9159ac94701107e0fe05aa795b611d004bdf35
1.4.2 2018-02-04 sha256 6b1945c3ee477f12be508a5bb41a5025d57de5510bcf94855ae6a4d59f3d86f4
1.4.1 2018-02-04 sha256 abd277cc3453be980bb48cbffe9d1f7422ca1ef4bc0b7d035fda87cea4d55cbc
1.4.0 2018-02-04 sha256 2e2d851f9ff3c9b526bfecc2e7f020cc7a74d8f64fbb403061d13f23f091a137
1.3.3 2018-02-04 sha256 2a63562e756a27b0f0391461bcf06306b3cfdaef54beec3728dde94e94a99d96
1.3.2 2018-02-04 sha256 6a4f761aa34bb69fca86bc411a5e9836ca8246f0fcd29f3804b174fee9fb0569
1.3.1 2018-02-04 sha256 f3e0faddf49039edf40ab62c497e0926286e8871a50228fd90ea91dcebbd15c3
1.3.0 2018-02-04 sha256 92ce3125cae2015c5c1f7657e78a6e239ff47b714eb1418288abf45d55f3be27
1.3.0-RC 2018-02-04 sha256 e21e98f17932a49a00bfbb1397b62c79f4e22937b09ff4d2fec92fca82381011
1.2.4 2018-02-04 sha256 3c900579659b79a4e528722e35bd160c86090e370e9cb41cc07c7a22c674c657
1.2.3 2018-02-04 sha256 3378c1422bffa09c29714aefd3240b963ce7731e71ae8894d9c7991101325cb8
1.2.2 2018-02-04 sha256 c6ae4e099351233f5f82ade9738475eec6587aadf9ffe66fec4c350b329fbb32
1.2.1 2018-02-04 sha256 c2e04040b807a8530e5c83de56bdaaf63a0f183f8fd449bbe6e41f660e647427
1.2.0 2018-02-04 sha256 dc80131545ed7f7b1369ae058824587f0718892f6a84bd86cfb0f28ab5e39095
1.2.0-RC 2018-02-04 sha256 1e1dddd7fbccd5de565cfb0429020d4f9f95a6207b48952d939aadcf891d2fdc
1.1.3 2018-02-04 sha256 4349ef555c8478b8fe148b10957bc40d696ce7b8cdeb7d50d3d684a854dca5cc
1.1.2 2018-02-04 sha256 7af2409080619e2ba98e78d7675710c23acf2ccf088d4439a4f79c33ed85c505
1.1.1 2018-02-04 sha256 7f26efee06de5a1a061b6b1e330f5acc9ee69976d1551118c45b21f358cbc332
1.1.0 2018-02-04 sha256 d8e1d21081b7076dfc9a570620e082111ab196dabd83780e50025c52d62b801c
1.1.0-RC 2018-02-04 sha256 31e771ed24f3db45019a073fe9e43a6a8e75249962012955cd105ebec0a08100
1.0.3 2018-02-04 sha256 78c5c0e3f41dcd4d6ee532d9ae7e23afa33bdd409d8824dff026f3991d6ad70a
1.0.2 2018-02-04 sha256 264673ccee900b22192605b8c74ecb77c45a5197347edacd142699866c478f4c
1.0.1 2018-02-04 sha256 de069dae8c7bf01adedc925d3ac2358e5318a1b05580b001aa04e585fa55d8c0
1.0.0 2018-02-04 sha256 1acc000cf23bd9d19e1590c2edeb44fb915f88d85f1798925ec989c601db0bd6
1.0.0-beta2 2018-02-04 sha256 128f8c7ad49a71e4abda885ca52c603e370d5cbed85479ae1eab4a58a398a6a4
1.0.0-beta1 2018-02-04 sha256 4344038a546bd0e9e2c4fa53bced1c7faef1bcccab09b2276ddd5cc01e4e022a
1.0.0-alpha11 2018-02-04 sha256 47347f16d366145eafb45d2e800012dc80cb8fc08d1d299849825c51465381ac
1.0.0-alpha10 2018-02-04 sha256 9f2c7d0364bc743bcde9cfe1fe84749e5ac38c46d47cf42966ce499135fd4628
1.0.0-alpha9 2018-02-04 sha256 33ef1c07649bc1e135e73f0944415753233faf803cff493006f8bd9e744ff1f4
1.0.0-alpha8 2018-02-04 sha256 1c73973d7cfb73f3e6b425b943a3e1459f5199984f37f008c48cf2b671dd3f2b
1.0.0-alpha7 2018-02-04 sha256 8fb4ac2da72856394b4bdd65d470797b23c27d496821a456046527fe6ccc9786
1.0.0-alpha6 2018-02-04 sha256 eacac2a637de230e6091fdb45e893705049f929c271a5dc90d2c9eac0f44c5c4
1.0.0-alpha5 2018-02-04 sha256 7e0fd9248b0f03ddbb3d20d4be2d130fecce432b66ff96f6e99a906f85d82796
1.0.0-alpha4 2018-02-04 sha256 b1f5737a3916ad34f74566be51d21f3597d9aebaa382d942c5bda4d1338008b3
1.0.0-alpha3 2018-02-04 sha256 7cac0a430602342a60949e580d49fefde57b5ff53d4b488e18d78aabf57eef19
1.0.0-alpha2 2018-02-04 sha256 acc373396d66d0083231a9d90691886e894ccca778398258e44c3dab60db2363
1.0.0-alpha1 2018-02-04 sha256 dd703cf132b2a6bb9b2a407ef8834cab9f433cf04f252f1a125b09f8f7a46912