Composer download for windows

Download Composer Latest: v2.8.9

Windows Installer

The installer — which requires that you have PHP already installed — will download Composer for you and set up your PATH environment variable
so you can simply call composer from any directory.

Download and run
Composer-Setup.exe
— it will install the latest composer version whenever it is executed.

Command-line installation

To quickly install Composer in the current directory, run the following script in your terminal.
To automate the installation, use the guide on installing Composer programmatically.

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

This installer script will simply check some php.ini settings,
warn you if they are set incorrectly, and then
download the latest composer.phar in the current directory. The 4 lines above will, in order:

  • Download the installer to the current directory
  • Verify the installer SHA-384, which you can also cross-check here
  • Run the installer
  • Remove the installer

Most likely, you want to put the composer.phar into a directory on your PATH, so you can simply call composer from any directory (Global install), using for example:

sudo mv composer.phar /usr/local/bin/composer

For details, see the instructions on how to install Composer globally.

WARNING: Please do not redistribute the install code.
It will change with every version of the installer.
Instead, please link to this page or check how to install Composer programmatically.

Notable Installer Options

—install-dir

You can install composer to a specific directory by using the --install-dir option and providing
a target directory. Example:

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

—filename

You can specify the filename (default: composer.phar) using the --filename option.
Example:

php composer-setup.php --filename=composer

—version

You can install composer to a specific release by using the --version option and providing a
target release. Example:

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

—preview, —snapshot, —1 (EOL), —2, —2.2 (LTS)

Select a specific version channel instead of the default latest stable. See «Download channels» below for more details. Example:

php composer-setup.php --2.2

—help

The installer provides more options for specific environments, use the
--help option to see all of them.

Download channels

By default the installer and composer self-update will
download the latest stable version only. You may select a different
download channel though.
If you would like to help test pre-release versions you can use the
--preview flag on either the installer or self-update.
For snapshot builds, which are done from the latest Composer commit,
you can use the --snapshot flag.
To programmatically install specific major versions you can use the
--1 or --2 flag. To select the latest 2.2 LTS
you can use --2.2.

Maintenance policy

Bug fixes are only guaranteed to be provided for the latest feature release.

Critical bug and security fixes are also provided for active LTS releases (currently 2.2).

Security fixes are still provided for 1.10 when applicable, but the version is deprecated and will eventually stop receiving fixes entirely.

Manual Download

If you prefer to download the phar manually, here are the available versions:

Latest Stable
(sha256 /
sha256sum /
asc) for PHP 7.2+ users

Latest Preview (alpha/beta/RC)
(sha256 /
sha256sum /
asc)

Latest Snapshot
(sha256 /
sha256sum)

Latest 1.x
(sha256 /
sha256sum)

Latest 2.x
(sha256 /
sha256sum /
asc)

Latest 2.2.x LTS
(sha256 /
sha256sum /
asc) for PHP 5.3 to 7.1 users

Composer (composer.phar) versions history

2.8.9 2025-05-13 sha256sum
8e8829ec2b97fcb05158236984bc252bef902e7b8ff65555a1eeda4ec13fb82b

asc
changelog
2.8.8 2025-04-04 sha256sum
957263e284b9f7a13d7f475dc65f3614d151b0c4dcc7e8761f7e7f749447fb68

asc
changelog
2.8.7 2025-04-03 sha256sum
2528507840901565fe6cecd19c7e9f8983b8d91b5eb4bab1599b14254401e675

asc
changelog
2.8.6 2025-02-25 sha256sum
becc28b909d2cca563e7caee1e488063312af36b1f2e31db64f417723b8c4026

asc
changelog
2.8.5 2025-01-21 sha256sum
9cef18212e222351aeb476b81de7b2a5383f775336474467bf5c7ccfe84ab0cc

asc
changelog
2.8.4 2024-12-11 sha256sum
c4c4e2e1beab0ea04e0bd042a5dbba9feda1fbf5eda0d36203958edd343c0a8a

asc
changelog
2.8.3 2024-11-17 sha256sum
8323b4105c6e166d47c9db93209370083f9e421743636e108c37d8c1126386ef

asc
changelog
2.8.2 2024-10-29 sha256sum
9ed076041e269820c6c4223d66c5325fcaddc7f4b4317b3ba936812a965857ed

asc
changelog
2.8.1 2024-10-04 sha256sum
930b376fbd2147a623ea7b704eb9d3b8b0d6072992207aa0535aa21f6f05378e

asc
changelog
2.8.0 2024-10-02 sha256sum
1b23f2a31cb05f0e8ae29b5723fc5edf37e565106d6fae2cf23f298efa9c8981

asc
changelog
2.7.9 2024-09-04 sha256sum
b6de5e65c199d80ba11897fbe1364e063e858d483f6a81a176c4d60f2b1d6347

asc
changelog
2.7.8 2024-08-22 sha256sum
3da35dc2abb99d8ef3fdb1dec3166c39189f7cb29974a225e7bbca04c1b2c6e0

asc
changelog
2.7.7 2024-06-10 sha256sum
aab940cd53d285a54c50465820a2080fcb7182a4ba1e5f795abfb10414a4b4be

asc
changelog
2.7.6 2024-05-04 sha256sum
29dc9a19ef33535db061b31180b2a833a7cf8d2cf4145b33a2f83504877bba08

asc
changelog
2.7.5 2024-05-03 sha256sum
0dc1f6bcb7a26ee165206010213c6069a537bf8e6533528739a864f154549b77

asc
changelog
2.7.4 2024-04-22 sha256sum
ee01080d632d2bbfa9c618009cca13718f36e751dda679a6009cee751c13b2d9

asc
changelog
2.7.3 2024-04-19 sha256sum
fcc02ff044b5a04fbecff0158cb6041c25e8f78ac494098736fecd2bb4f381e4

asc
changelog
2.7.2 2024-03-11 sha256sum
049b8e0ed9f264d770a0510858cffbc35401510759edc9a784b3a5c6e020bcac

asc
changelog
2.7.1 2024-02-09 sha256sum
1ffd0be3f27e237b1ae47f9e8f29f96ac7f50a0bd9eef4f88cdbe94dd04bfff0

asc
changelog
2.7.0 2024-02-08 sha256sum
2fc501cbef1891379523ee4989d37bf04798415a05f8eb44ae75acb2fdf2596f

asc
changelog
2.6.6 2023-12-08 sha256sum
72600201c73c7c4b218f1c0511b36d8537963e36aafa244757f52309f885b314

asc
changelog
2.6.5 2023-10-06 sha256sum
9a18e1a3aadbcb94c1bafd6c4a98ff931f4b43a456ef48575130466e19f05dd6

asc
changelog
2.6.4 2023-09-29 sha256sum
5a39f3e2ce5ba391ee3fecb227faf21390f5b7ed5c56f14cab9e1c3048bcf8b8

asc
changelog
2.6.3 2023-09-15 sha256sum
e58a390cac0df45ccf5a3d95ae94fa239eded8b7907fa2c8f752f020304fc9b1

asc
changelog
2.6.2 2023-09-03 sha256sum
88c84d4a53fcf1c27d6762e1d5d6b70d57c6dc9d2e2314fd09dbf86bf61e1aef

asc
changelog
2.6.1 2023-09-01 sha256sum
216bd5a516b544783fdce1a9e3a1eeb41f0aa9f0edb20dcd04f2846df64d3661

asc
changelog
2.6.0 2023-09-01 sha256sum
3b190c1cb72670fc033a4831e68c02068c0300616bde4d6ef4d1a183b7d33cc4

asc
changelog
2.5.8 2023-06-09 sha256sum
f07934fad44f9048c0dc875a506cca31cc2794d6aebfc1867f3b1fbf48dce2c5

asc
changelog
2.5.7 2023-05-24 sha256sum
9256c4c1c803b9d0cb7a66a1ab6c737e48c43cc6df7b8ec9ec2497a724bf44de

asc
changelog
2.5.6 2023-05-24 sha256sum
79021fbedfb2b383d606d0cf2161eb2b034099ca4794ffa572e8575f7c5dabc8

asc
changelog
2.5.5 2023-03-21 sha256sum
566a6d1cf4be1cc3ac882d2a2a13817ffae54e60f5aa7c9137434810a5809ffc

asc
changelog
2.5.4 2023-02-15 sha256sum
91ce6cbf9463eae86ae9d5c21d42faa601a519f3fbb2b623a55ee24678079bd3

asc
changelog
2.5.3 2023-02-10 sha256sum
2e1061821951c6a5ece033a025d06296d4a1d056fee2f4bebd35815cf4b1b0f9

asc
changelog
2.5.2 2023-02-04 sha256sum
0844c3dd85bbfa039d33fbda58ae65a38a9f615fcba76948aed75bf94d7606ca

asc
changelog
2.5.1 2022-12-22 sha256sum
f1b94fee11a5bd6a1aae5d77c8da269df27c705fcc806ebf4c8c2e6fa8645c20

asc
changelog
2.5.0 2022-12-20 sha256sum
b571610e5451785f76389a08e9575d91c3d6e38fee1df7a9708fe307013c8424

asc
changelog
2.4.4 2022-10-27 sha256sum
c252c2a2219956f88089ffc242b42c8cb9300a368fd3890d63940e4fc9652345

asc
changelog
2.4.3 2022-10-14 sha256sum
26d72f2790502bc9b22209e1cec1e0e43d33b368606ad227d327cccb388b609a

asc
changelog
2.4.2 2022-09-14 sha256sum
8fe98a01050c92cc6812b8ead3bd5b6e0bcdc575ce7a93b242bde497a31d7732

asc
changelog
2.4.1 2022-08-20 sha256sum
ea8cf6308ec76ff9645c3818841a7588096b9dc2767345fbd4bd492dd8a6dca6

asc
changelog
2.4.0 2022-08-16 sha256sum
1cdc74f74965908d0e98d00feeca37c23b86da51170a3a11a1538d89ff44d4dd

asc
changelog
2.4.0-RC1 2022-07-21 sha256sum
320ad515ec2bfd96f84898eeab5db5bc9305f140b946cbbe0f2290e82029db82

asc
changelog
2.3.10 2022-07-13 sha256sum
d808272f284fa8e0f8b470703e1438ac8f362030bbc9d12e29530277d767aff0

asc
changelog
2.3.9 2022-07-05 sha256sum
0ec0cd63115cad28307e4b796350712e3cb77db992399aeb4a18a9c0680d7de2

asc
changelog
2.3.8 2022-07-01 sha256sum
c6ab768ad3239c4d4cc4f39f8ff7462925e088cd441e5bdb749fbf6efe049769

asc
changelog
2.3.7 2022-06-06 sha256sum
3f2d46787d51070f922bf991aa08324566f726f186076c2a5e4e8b01a8ea3fd0

asc
changelog
2.3.6 2022-06-01 sha256sum
188e079d509156130d30204c9c8b3f00134dbbc6afadc2f37ed05d02646a47dc

asc
changelog
2.3.5 2022-04-13 sha256sum
3b3b5a899c06a46aec280727bdf50aad14334f6bc40436ea76b07b650870d8f4

asc
changelog
2.3.4 2022-04-07 sha256sum
1fc8fc5b43f081fe76fa85eb5a213412e55f54a60bae4880bc96521ae482d6c3

asc
changelog
2.3.3 2022-04-01 sha256sum
d6931ec2b38b41bd0ad62f9d157908e6688bac091bbf0bd6a619c1067b922402

asc
changelog
2.3.2 2022-03-30 sha256sum
8ec134fe04ee52cd6465384c535ec61107368d4866ade9e995dcb96d8676f0c3

asc
changelog
2.3.1 2022-03-30 sha256sum
35088e641c5e0f463652b20425e2a623095f539fb3a038ba8dccf1ce07f0eca9

asc
changelog
2.3.0 2022-03-30 sha256sum
07d7d2adeaccd97eefa96c26bc6742b465b808b77bbf4246cf2b556970c2bcb1

asc
changelog
2.3.0-RC2 2022-03-20 sha256sum
8e533738ad90e9fa4811348fda361a38f544c420f5a4ea17ed6ed64edd7509fe

asc
changelog
2.3.0-RC1 2022-03-16 sha256sum
eb34514c87d16bad4cb7e45eca41df36b728ec8cf9c3a0487e6ac21bda96a132

asc
changelog
2.2.25 2024-12-11 sha256sum
8b3f41253363f0645402d1951d6e7f02adedeef29c16de6074763e463e25c23f

asc
changelog
2.2.24 2024-06-10 sha256sum
b0c383b1f430a80a74c006f20199d1e0226848a0a90afa5c0a7d01fb90ee9075

asc
changelog
2.2.23 2024-02-08 sha256sum
060ff6b6b8bfb60a943c94954cc4e8bf3e780ff33ecd7c7d9eb2f43241f39740

asc
changelog
2.2.22 2023-09-29 sha256sum
7d3500cc8c9a74b47e14103de150ac95c25ca227b39ffc89cb3a8b495b5db1d2

asc
changelog
2.2.21 2023-02-15 sha256sum
5211584ad39af26704da9f6209bc5d8104a2d576e80ce9c7ed8368ddd779d0af

asc
changelog
2.2.20 2023-02-10 sha256sum
d16bb62fd408109583e8f0c237909d4b1b32fb14ab9cfc15847d11086ba51dec

asc
changelog
2.2.19 2023-02-04 sha256sum
325a7cb79ba2d34b27789b314504a8a028d1dde5a495445942bf66f5c19b30b1

asc
changelog
2.2.18 2022-08-20 sha256sum
28a8d9740d615137a8c01d32aef9184db16f543fca36db038501a294d8e95b24

asc
changelog
2.2.17 2022-07-13 sha256sum
ec034d3d92c94ab63ebdf1a2bfa9f5e34cb08b043dae91958c6fcb2f47170cea

asc
changelog
2.2.16 2022-07-05 sha256sum
06932837764594c4864f913615d5ece24e8f0c40b8f074a5e00eacb23d3ae2c9

asc
changelog
2.2.15 2022-07-01 sha256sum
c83adb636c9e5eb22c6c7ccd8c3e54a3ee515f849caef0ec46d378637c4fab32

asc
changelog
2.2.14 2022-06-06 sha256sum
84433f01bcd778f59ec150a1cdd4991c3d9b6cf74bcb7b6c18cdcd1e5efed9d4

asc
changelog
2.2.13 2022-05-25 sha256sum
4c3a6cbe00ad0aaae965523033d511fdf558ff7ff673749d925b7860c1807637

asc
changelog
2.2.12 2022-04-13 sha256sum
1ce90687eb3f89a99c059d45dd419d08430ed249468544b932b1dad7fb22dda0

asc
changelog
2.2.11 2022-04-01 sha256sum
87c4aa2955437245fe510e6b2c794b17aba9ff6761a832fda4785863a23c5ba4

asc
changelog
2.2.10 2022-03-29 sha256sum
dc9dfdd2ffb1180d785b5a3d581c946ec6da135f55c9959f21b96fea7d7fb12d

asc
changelog
2.2.9 2022-03-15 sha256sum
48f9fdc9ad93904fee96550b45ae03a51f69718502ee855da894b4ad71d2dfe0

asc
changelog
2.2.8 2022-03-15 sha256sum
e1e1c580a237c739ecc1be57cf512e6b741faaa566439257d19ecd739ddfefaf

asc
changelog
2.2.7 2022-02-25 sha256sum
10040ded663541990eef8ce1f6fa44cb3b4a47e145efb8e9e59907a15068033d

asc
changelog
2.2.6 2022-02-04 sha256sum
1d58486b891e59e9e064c0d54bb38538f74d6014f75481542c69ad84d4e97704

asc
changelog
2.2.5 2022-01-21 sha256sum
81ef304a70c957d6f05a7659f03b00eb50df6155195f51118459b2e49c96c3f3

asc
changelog
2.2.4 2022-01-08 sha256sum
ba04e246960d193237d5ed6542bd78456898e7787fafb586f500c6807af7458d

asc
changelog
2.2.3 2021-12-31 sha256sum
721cc27f81c6485fff70e6f56b9f2aadae770a1f8974a384c34e35987a230d8c

asc
changelog
2.2.2 2021-12-29 sha256sum
7391e020cd3ed1a158fd6cfc0b79d7c005854396536b5499e58fc6eedb544b4e

asc
changelog
2.2.1 2021-12-22 sha256sum
1d2067cd8a4df546498b04817b0fa3827f291d564bcde29254e8d6d2db15f896

asc
changelog
2.2.0 2021-12-22 sha256sum
f7928b5465ad14c49901174d72c701d74ee278479ae19a44f6a46839e2d87d4d

asc
changelog
2.2.0-RC1 2021-12-08 sha256sum
c86b1e37ecb73aa19306a6db8693ed002a202d16604f9f2093d6321ceb23afca

asc
changelog
2.1.14 2021-11-30 sha256sum
d44a904520f9aaa766e8b4b05d2d9a766ad9a6f03fa1a48518224aad703061a4

asc
changelog
2.1.12 2021-11-09 sha256sum
ae3ec292dd04b4e468aea1e5db4d085f169d8a803aabeb99707f69e9454bf218

asc
changelog
2.1.11 2021-11-02 sha256sum
fdb587131f8a11fcd475c9949ca340cc58a4b50cce6833caa8118b759a4ad1a3

asc
changelog
2.1.10 2021-10-29 sha256sum
cb8b04cc6a6fb167403f7495e8539650eb555657aa48873f115383bcd8f0b18d

asc
changelog
2.1.9 2021-10-05 sha256sum
4d00b70e146c17d663ad2f9a21ebb4c9d52b021b1ac15f648b4d371c04d648ba

asc
changelog
2.1.8 2021-09-15 sha256sum
77b8aca1b41174a67f27be066558f8a96f489916f4cded2bead3cab6a3f33590

asc
changelog
2.1.7 2021-09-14 sha256sum
2936587e1babafa50d15eacf9fe775e825ed2e1f051c61acd3fa4f6af7720e94

asc
changelog
2.1.6 2021-08-19 sha256sum
72524ccebcb071968eb83284507225fdba59f223719b2b3f333d76c8a9ac6b72

asc
changelog
2.1.5 2021-07-23 sha256sum
be95557cc36eeb82da0f4340a469bad56b57f742d2891892dcb2f8b0179790ec

asc
changelog
2.1.4 2021-07-22 sha256sum
3c8f521888ccb51becae522e263dbfd17169fbf3d4716685858b2c7e7684f4ae

asc
changelog
2.1.3 2021-06-09 sha256sum
f8a72e98dec8da736d8dac66761ca0a8fbde913753e9a43f34112367f5174d11

asc
changelog
2.1.2 2021-06-07 sha256sum
2dec01094a6bd571dcc0ed796b6e180aca3833646834b66eb743b7d66787a43d

asc
changelog
2.1.1 2021-06-04 sha256sum
445a577f3d7966ed2327182380047a38179068ad1292f6b88de4e071920121ce

asc
changelog
2.1.0 2021-06-03 sha256sum
2f8e8f684db5d6bd36a549629f3676e48f008624f499b13dfc7afa2f9cbde16e

asc
changelog
2.1.0-RC1 2021-06-02 sha256sum
5e1413b44cd517af3f4d9ff5a66e6e053c0769eef30588bcd4f941209ed5a6be

asc
changelog
2.0.14 2021-05-21 sha256sum
29454b41558968ca634bf5e2d4d07ff2275d91b637a76d7a05e6747d36dd3473

asc
changelog
2.0.13 2021-04-27 sha256sum
116fdf07cc926af646635a6abc92d88aff7b02a5dc36538f81c50a7d27366dbf

asc
changelog
2.0.12 2021-04-01 sha256sum
82ea8c1537cfaceb7e56f6004c7ccdf99ddafce7237c07374d920e635730a631

asc
changelog
2.0.11 2021-02-24 sha256sum
d6eee0d4637f4bd82bdae098fceda300dcb3ec35bf502604fbe7510933b8f952

asc
changelog
2.0.10 2021-02-23 sha256sum
72a5a68d12f315d74d931462413f7e114cd77b4be1a6b9494141dda93410751a

asc
changelog
2.0.9 2021-01-27 sha256sum
8e91344a5ca2fc0fb583c50f195a1f36918908561c4ea3d6f01a4ef01c3b8560

asc
changelog
2.0.8 2020-12-03 sha256sum
2021f0d52b446e0efe3c548cc058ab5671fa38cdbcf814e7911c7e9d71d61538

asc
changelog
2.0.7 2020-11-13 sha256sum
0a060e8caf1d5cde55c4562fd68369b08cf231b8fd30da9c8f994b111557ebe9

asc
changelog
2.0.6 2020-11-07 sha256sum
e5e39d8fa699ddb09844f6b4388280ff2c805fef0a7c26580c5bbc91ac35091b

asc
changelog
2.0.5 2020-11-06 sha256sum
e786d1d997efc1eb463d7447394b6ad17a144afcf8e505a3ce3cb0f60c3302f9

asc
changelog
2.0.4 2020-10-30 sha256sum
c3b2bc477429c923c69f7f9b137e06b2a93c6a1e192d40ffad1741ee5d54760d

asc
changelog
2.0.3 2020-10-28 sha256sum
5d377e9b504dc9f6c9228d81c321ba85290512cdb396a12d3708b0cd30d2e20c

asc
changelog
2.0.2 2020-10-25 sha256sum
5e122edd0f2a4fb01172b6b1c156b3d252d9205105b4ad169a4b09913ba6a859
changelog
2.0.1 2020-10-24 sha256sum
4b4b118cc54662e4813ba86efb215fdb19c5b29944c5919b4f2803c915aa2234
changelog
2.0.0 2020-10-24 sha256sum
139657aa2b37867800292724145e3c4895f7755d845758b403dc329d17bdd285
changelog
2.0.0-RC2 2020-10-14 sha256sum
337b69c2fbf56c158538b7521bea6b09c42a29d39c4b8b25e55d21ba1440f807
changelog
2.0.0-RC1 2020-09-10 sha256sum
0d3a60be9515c87d6c061899ddaa23aa1476b34f7c0f75e562a928f58019f973
changelog
2.0.0-alpha3 2020-08-03 sha256sum
56acbd0b4c3314dac87a04fe44fe55bdfc117da38dfee8fd29528093d1e704bf
changelog
2.0.0-alpha2 2020-06-24 sha256sum
6490fc59e48bf1ea5f3301cde071a56dc63e9a7dbb5540a94501bec570cabd5d
changelog
2.0.0-alpha1 2020-06-03 sha256sum
22ff90cd50d331bfab5c4eef35b5290a83a5bf7fadf52d47b72aade01e893920
changelog
1.10.27 2023-09-29 sha256sum
230d28fb29f3c6c07ab2382390bef313e36de17868b2bd23b2e070554cae23d2
changelog
1.10.26 2022-04-13 sha256sum
cbfe1f85276c57abe464d934503d935aa213494ac286275c8dfabfa91e3dbdc4
changelog
1.10.25 2022-01-21 sha256sum
6b089bd8b78b00c3c15d7b13353fbcbdf16a3f5248203c9a3e76f13948f2de92
changelog
1.10.24 2021-12-09 sha256sum
542ce16add6fd5ecfb0049dd49a0214e69a966a602b42c215adb19438c13a890
changelog
1.10.23 2021-10-05 sha256sum
2fc3ae370a979602a3bc2c950a38db02e51b4ca2072f7b8e15a518b443b835e7
changelog
1.10.22 2021-04-27 sha256sum
6127ae192d3b56cd6758c7c72fe2ac6868ecc835dae1451a004aca10ab1e0700
changelog
1.10.21 2021-04-01 sha256sum
1477d56da4a941de4203982c05b8a371ee4a9f2bb88a69f1b31c75d6bd6b8306
changelog
1.10.20 2021-01-27 sha256sum
e70b1024c194e07db02275dd26ed511ce620ede45c1e237b3ef51d5f8171348d
changelog
1.10.19 2020-12-04 sha256sum
688bf8f868643b420dded326614fcdf969572ac8ad7fbbb92c28a631157d39e8
changelog
1.10.18 2020-12-03 sha256sum
322d769490aedb12f95fa5f32e2c20f5753b07700a259472db427ddcf843884b
changelog
1.10.17 2020-10-30 sha256sum
6fa00eba5103ce6750f94f87af8356e12cc45d5bbb11a140533790cf60725f1c
changelog
1.10.16 2020-10-24 sha256sum
e494bb438e44b9e4782c16940b229a8c46ea8a3baa9b908bf9db310cd0171ee2
changelog
1.10.15 2020-10-13 sha256sum
a69df12e86a0a18fbedfc91a33d5f9acc5cf939576e0258326074fc1b2ee1aea
changelog
1.10.14 2020-10-13 sha256sum
ec8c97badf06c1d51bdc2fe16d75bc7306a08a112b12a34563ff8da5d6621db7
changelog
1.10.13 2020-09-09 sha256sum
5ca7445cfd48dd27c5a84aa005a47b4d9fd91132313830609875df3a6973708f
changelog
1.10.12 2020-09-08 sha256sum
ad32ebf620bffabe1e680802da610e8ba2eea4ecbbd76df973ce47d2ff192cba
changelog
1.10.11 2020-09-08 sha256sum
6c4e61d21d2dd2c30da5e8dc244b302939678abaca82196eb0cf5ed7c9f4b143
changelog
1.10.10 2020-08-03 sha256sum
8f16aa77b1236ed40855d8d141c0a939d108a939c8e73f9f32eadd3f05f181b9
changelog
1.10.9 2020-07-16 sha256sum
70d6b9c3e0774b398a372dcb7f89dfe22fc25884e6e09ebf277286dd64cfaf35
changelog
1.10.8 2020-06-24 sha256sum
4c40737f5d5f36d04f8b2df37171c6a1ff520efcadcb8626cc7c30bd4c5178e5
changelog
1.10.7 2020-06-03 sha256sum
b94b872729668de5b5fbf62f16ff588d2a23480dda88c0e45cb43b721b75ae29
changelog
1.10.6 2020-05-06 sha256sum
29bdac1bda34d8902b9f9e4f5816de08879b8f3fafad901e4283519cdefbee7b
changelog
1.10.5 2020-04-10 sha256sum
d5f3fddd0be28a5fc9bf2634a06f51bc9bd581fabda93fee7ca8ca781ae43129
changelog
1.10.4 2020-04-09 sha256sum
642df93a823f7d45ea544b337542a405ceb3e6c0b7b04d48574801ca364bfa9a
changelog
1.10.3 2020-04-09 sha256sum
2e162689cbb198943be915247c3cb34ba7810f9ee3c608288c6775668b22a98d
changelog
1.10.2 2020-04-09 sha256sum
1faea4a90f74692a765181a3025ada7c8ed1a8f87ca3fae229471876841d8484
changelog
1.10.1 2020-03-13 sha256sum
1831f266580f221189dc04d4b58d7fc50c934ffc3a0eca89ecb4a53aa44867e2
changelog
1.10.0 2020-03-10 sha256sum
8ced713bde2d89468c3385588daf27dc6fc7bc7619f95239068608d303700b09
changelog
1.10.0-RC 2020-02-14 sha256sum
58c5d690ec1ee348efed8d59e529dd322bca1d4f588d08eb20100f1c855bade4
changelog
1.9.3 2020-02-04 sha256sum
551655c2fc81f4106508f42bbc4b24eabd34b022b13bc1e7d9642bf483d0a7d4
changelog
1.9.2 2020-01-14 sha256sum
58753998712ae435915a452d701ae28a9389653bbf36b3b6adf24e03d90a9467
changelog
1.9.1 2019-11-01 sha256sum
1f210b9037fcf82670d75892dfc44400f13fe9ada7af9e787f93e50e3b764111
changelog
1.9.0 2019-08-02 sha256sum
c9dff69d092bdec14dee64df6677e7430163509798895fbd54891c166c5c0875
changelog
1.8.6 2019-06-11 sha256sum
b66f9b53db72c5117408defe8a1e00515fe749e97ce1b0ae8bdaa6a5a43dd542
changelog
1.8.5 2019-04-09 sha256sum
4e4c1cd74b54a26618699f3190e6f5fc63bb308b13fa660f71f2a2df047c0e17
changelog
1.8.4 2019-02-11 sha256sum
1722826c8fbeaf2d6cdd31c9c9af38694d6383a0f2bf476fe6bbd30939de058a
changelog
1.8.3 2019-01-30 sha256sum
5733ae9516e9185b7c3328d16dac75f3475f8ef137572dfb497f0f298157df33
changelog
1.8.2 2019-01-29 sha256sum
489025eb489a2a70b8cdd7acd53f530e7be22a342b8c971a9d73091b898c7aed
changelog
1.8.1 2019-01-29 sha256sum
ded65cb32160648146a264eaf4b4919308b3f1fdc8e38a0dde8406396860dfab
changelog
1.8.0 2018-12-03 sha256sum
0901a84d56f6d6ae8f8b96b0c131d4f51ccaf169d491813d2bcedf2a6e4cefa6
changelog
1.7.3 2018-11-01 sha256sum
bc6cbcd2c0fbc03c7ab87442b5f1fbc9407f0b9900bddc10d755bdc81bbe7b6e
changelog
1.7.2 2018-08-16 sha256sum
ec3428d049ae8877f7d102c2ee050dbd51a160fc2dde323f3e126a3b3846750e
changelog
1.7.1 2018-08-07 sha256sum
1c0e95dc3f33985f9eeabb6f57896c0f9d46b7c9e70ad7bf2210a5508869a8fa
changelog
1.7.0 2018-08-03 sha256sum
88068af567884a6266ef255d3d17053f583c9074dc75161b7a35eda8e553849a
changelog
1.7.0-RC 2018-07-24 sha256sum
902d97573567b72a07754b20c64949ba878bb85571c0d3e5c6ddae66ffb278c0
changelog
1.6.5 2018-05-04 sha256sum
67bebe9df9866a795078bb2cf21798d8b0214f2e0b2fd81f2e907a8ef0be3434
changelog
1.6.4 2018-04-13 sha256sum
8d0d9246f68532cc8fd6a47a58d195f0c849d26430f93c397a3176fc2d971ded
changelog
1.6.3 2018-01-31 sha256sum
52cb7bbbaee720471e3b34c8ae6db53a38f0b759c06078a80080db739e4dcab6
changelog
1.6.2 2018-01-05 sha256sum
6ec386528e64186dfe4e3a68a4be57992f931459209fd3d45dde64f5efb25276
changelog
1.6.1 2018-01-04 sha256sum
71b6701ab75c93d0986b3e906d9d2586f0ae1b3e611583210a9542021861f581
changelog
1.6.0 2018-01-04 sha256sum
45031b4ae95bb6f4bdd33704a1932bfb8b56f5a590ee16b4946f481903c28fd1
changelog
1.6.0-RC 2017-12-19 sha256sum
fbbc2a8085331976ff08a7920230a30e38b847b1f3bfbae54e1c0ea6676b2fae
changelog
1.5.6 2017-12-18 sha256sum
25e75d72818c4f1d46b3ae47a8deaaf4ef25c87198329d4a6ee53601b00459e5
changelog
1.5.5 2017-12-01 sha256sum
8ef8c4fb73c8cc1e950119799aec31e0ae5913dab8dd8f53d9c2e3985ac3ad2b
changelog
1.5.4 2017-12-01 sha256sum
b85461bb94c1abf1ccaa6832a7992c08d2d851f844c575626766554bd96de8c3
changelog
1.5.3 2017-11-30 sha256sum
f50e3b1d7daa6afc532341e52735db32819310cb2f63cb166f69dc7e074a657e
changelog
1.5.2 2017-09-11 sha256sum
c0a5519c768ef854913206d45bd360efc2eb4a3e6eb1e1c7d0a4b5e0d3bbb31f
changelog
1.5.1 2017-08-09 sha256sum
2745e7b8cced2e97f84b9e9cb0f9c401702f47cecea5a67f095ac4fa1a44fb80
changelog
1.5.0 2017-08-08 sha256sum
8a9f570241f1f858529c13f4d09d38b3379fe1a1d27cb74bc71093f1a8f1b225
changelog
1.4.3 2017-08-06 sha256sum
03fc40c59e1e5711d61d6f340e9159ac94701107e0fe05aa795b611d004bdf35
changelog
1.4.2 2017-05-17 sha256sum
6b1945c3ee477f12be508a5bb41a5025d57de5510bcf94855ae6a4d59f3d86f4
changelog
1.4.1 2017-03-10 sha256sum
abd277cc3453be980bb48cbffe9d1f7422ca1ef4bc0b7d035fda87cea4d55cbc
changelog
1.4.0 2017-03-08 sha256sum
2e2d851f9ff3c9b526bfecc2e7f020cc7a74d8f64fbb403061d13f23f091a137
changelog
1.3.3 2017-03-08 sha256sum
2a63562e756a27b0f0391461bcf06306b3cfdaef54beec3728dde94e94a99d96
changelog
1.3.2 2017-01-27 sha256sum
6a4f761aa34bb69fca86bc411a5e9836ca8246f0fcd29f3804b174fee9fb0569
changelog
1.3.1 2017-01-07 sha256sum
f3e0faddf49039edf40ab62c497e0926286e8871a50228fd90ea91dcebbd15c3
changelog
1.3.0 2016-12-23 sha256sum
92ce3125cae2015c5c1f7657e78a6e239ff47b714eb1418288abf45d55f3be27
changelog
1.3.0-RC 2016-12-11 sha256sum
e21e98f17932a49a00bfbb1397b62c79f4e22937b09ff4d2fec92fca82381011
changelog
1.2.4 2016-12-06 sha256sum
3c900579659b79a4e528722e35bd160c86090e370e9cb41cc07c7a22c674c657
changelog
1.2.3 2016-12-01 sha256sum
3378c1422bffa09c29714aefd3240b963ce7731e71ae8894d9c7991101325cb8
changelog
1.2.2 2016-11-03 sha256sum
c6ae4e099351233f5f82ade9738475eec6587aadf9ffe66fec4c350b329fbb32
changelog
1.2.1 2016-09-12 sha256sum
c2e04040b807a8530e5c83de56bdaaf63a0f183f8fd449bbe6e41f660e647427
changelog
1.2.0 2016-07-18 sha256sum
dc80131545ed7f7b1369ae058824587f0718892f6a84bd86cfb0f28ab5e39095
changelog
1.2.0-RC 2016-07-04 sha256sum
1e1dddd7fbccd5de565cfb0429020d4f9f95a6207b48952d939aadcf891d2fdc
changelog
1.1.3 2016-06-26 sha256sum
4349ef555c8478b8fe148b10957bc40d696ce7b8cdeb7d50d3d684a854dca5cc
changelog
1.1.2 2016-05-31 sha256sum
7af2409080619e2ba98e78d7675710c23acf2ccf088d4439a4f79c33ed85c505
changelog
1.1.1 2016-05-17 sha256sum
7f26efee06de5a1a061b6b1e330f5acc9ee69976d1551118c45b21f358cbc332
changelog
1.1.0 2016-05-10 sha256sum
d8e1d21081b7076dfc9a570620e082111ab196dabd83780e50025c52d62b801c
changelog
1.1.0-RC 2016-04-29 sha256sum
31e771ed24f3db45019a073fe9e43a6a8e75249962012955cd105ebec0a08100
changelog
1.0.3 2016-04-29 sha256sum
78c5c0e3f41dcd4d6ee532d9ae7e23afa33bdd409d8824dff026f3991d6ad70a
changelog
1.0.2 2016-04-21 sha256sum
264673ccee900b22192605b8c74ecb77c45a5197347edacd142699866c478f4c
changelog
1.0.1 2016-04-18 sha256sum
de069dae8c7bf01adedc925d3ac2358e5318a1b05580b001aa04e585fa55d8c0
changelog
1.0.0 2016-04-05 sha256sum
1acc000cf23bd9d19e1590c2edeb44fb915f88d85f1798925ec989c601db0bd6
changelog
1.0.0-beta2 2016-03-27 sha256sum
128f8c7ad49a71e4abda885ca52c603e370d5cbed85479ae1eab4a58a398a6a4
changelog
1.0.0-beta1 2016-03-03 sha256sum
4344038a546bd0e9e2c4fa53bced1c7faef1bcccab09b2276ddd5cc01e4e022a
changelog
1.0.0-alpha11 2015-11-14 sha256sum
47347f16d366145eafb45d2e800012dc80cb8fc08d1d299849825c51465381ac
changelog
1.0.0-alpha10 2015-04-14 sha256sum
9f2c7d0364bc743bcde9cfe1fe84749e5ac38c46d47cf42966ce499135fd4628
changelog
1.0.0-alpha9 2014-12-07 sha256sum
33ef1c07649bc1e135e73f0944415753233faf803cff493006f8bd9e744ff1f4
changelog
1.0.0-alpha8 2014-01-06 sha256sum
1c73973d7cfb73f3e6b425b943a3e1459f5199984f37f008c48cf2b671dd3f2b
changelog
1.0.0-alpha7 2013-05-04 sha256sum
8fb4ac2da72856394b4bdd65d470797b23c27d496821a456046527fe6ccc9786
changelog
1.0.0-alpha6 2012-10-23 sha256sum
eacac2a637de230e6091fdb45e893705049f929c271a5dc90d2c9eac0f44c5c4
changelog
1.0.0-alpha5 2012-08-18 sha256sum
7e0fd9248b0f03ddbb3d20d4be2d130fecce432b66ff96f6e99a906f85d82796
changelog
1.0.0-alpha4 2012-07-04 sha256sum
b1f5737a3916ad34f74566be51d21f3597d9aebaa382d942c5bda4d1338008b3
changelog
1.0.0-alpha3 2012-05-13 sha256sum
7cac0a430602342a60949e580d49fefde57b5ff53d4b488e18d78aabf57eef19
changelog
1.0.0-alpha2 2012-04-03 sha256sum
acc373396d66d0083231a9d90691886e894ccca778398258e44c3dab60db2363
changelog
1.0.0-alpha1 2012-03-01 sha256sum
dd703cf132b2a6bb9b2a407ef8834cab9f433cf04f252f1a125b09f8f7a46912
changelog

Composer-Setup 6.3.0

  • Added existing version uninstallation. This is done silently in the background just before the main installation and creates an Uninstall Log in the temp directory.
  • Removed approval page for ini updates, which now happen automatically and are shown to the user on the Ready to Install page.
  • Reworked ini update handling to fix extension_dir errors.
  • Improved PHP checks and changed to using runphp for all scripts.
  • Added output capturing from runphp using cmd.exe.
  • Changed runphp to execute any commands, rather than just -v, with a 30 second safety timeout.

Composer-Setup 6.2.0

  • Removed MinVersion to use the default. Windows Vista is no longer supported. This is required to
    make the installer more secure on supported versions (Windows 7 updwards).
  • Removed expiring DST Root CA X3 certificate so that OpenSSL and Curl will work using ISRG Root X1.

Composer-Setup 6.1.0

  • Fixed path searching to use native System32 directories on x64.
  • Fixed cmd.exe invocations to use the 64-bit version on x64.
  • Fixed codepage issues with cmd.exe output: #123.

Composer-Setup 6.0.0

  • Disabled deprecation warnings in php scripts.
  • Fixed PHP 8 openssl_free_key deprecation warning: #122.
  • Updated to latest installer script, including certificate data from Wed Jul 22 03:12:14 2020 GMT.
  • Improve proxy handling by making proxy discovery match Composer behaviour and by reporting proxy
    urls in the log file, masked to hide sensitive data.
  • Fixed potential escalation of privileges by locking down the bin folder for admin installs.
  • Added a path security warning which requires the user to confirm that it is their responsibilty
    to ensure the access control of a folder being added or replaced on the system path. This affects
    standard admin installs, but not silent or Deverloper Mode installs with admin priveleges.
  • Improved and documented ini update handling.
  • Fixed failures when the ini contains relative root paths, as in xampp portable, by running PHP
    from the drive it is installed on and using full paths to the php scripts. This unfortunately
    breaks Cygwin PHP installations. Reported in #116.
  • Fixed runphp.exe reporting PHP fatal errors by calling PHP with the -n (no ini) option, which
    lets the user see the error later: #116.
  • Added cmd.exe checking to flush out misconfigrations before it is used to call the php scripts.
  • Fixed missing captions on settings error page when cmd or php did not run.
  • Added logging of command-line params.
  • Fixed bug when admin installing in user-mode could not change global environment.
  • Further improvements to Chocolatey package so it can be accepted as a core-team package.
  • Fixed installer script to handle uopz extension if it prevents exit calls.

Composer-Setup 5.1.0

  • Added the identifier Composer-Setup.exe (plus version) to the user-agent header when downloading.
  • Improved path handling to remove all instances of PHP and Composer when adding new values.
  • Updated to latest installer script which fixes NO_PROXY handling bug and includes certificate data
    from Wed Nov 27 04:12:10 2019 GMT.

Composer-Setup 5.0.0

  • Improved the Chocolatey package release process to use their automatic update module.
  • Added the curl extension to php.ini modifications which will be needed in Composer 2.
  • Updated to Inno Setup 6 which provides a modern resizable interface and drops support for Windows XP.
  • Restricted PHP to 5.5 upwards because lower versions do not use the TLS protocols required to
    download the installer and connect to Packagist.
  • Removed the security page that allowed the user to disable TLS.
  • Improved wording on environment changes page: #103
  • Updated the installer script to recognize the HTTPS_PROXY and NO_PROXY environment variables and to include certificate data from Wed Oct 16 03:12:09 2019 GMT.
  • Improved proxy display and handling, which nows allows the user to override settings from
    Internet Options: #91
  • Fixed crash caused by Inno Setup 5 bug when calling ExpandUNCFileName with a path longer than 259 characters. This occured when a user had an entry named %PATH% in their Path environment variable, so Setup now checks for the path separator in an expanded path: #92.
  • Improved extension enabling in php.ini so that only the extension name is used for PHP7.2 upwards.
  • Improved search for common PHP locations.

Composer-Setup 4.10.0

  • Updated to latest installer script, including certificate data from Wed Jan 23 04:12:09 2019 GMT.
  • Fixed POSIX incompatibility in shim script.

Composer-Setup 4.9.0

  • Improved installer error reporting to show common OpenSSL and proxy errors.
  • Stopped ini-handling from modifying an ini file if it is not in the php.exe directory.
  • Added PHPRC detection, which is reported if used.
  • Updated to latest installer script, including certificate data from Wed Jun 20 03:12:06 2018 GMT.

Composer-Setup 4.8.0

  • Changed error reporting by forcing all errors to stderr with ini overrides.
  • Changed detection of old PHP versions for better error handling.
  • Fixed argument escaping to handle unusual path characters.
  • Fixed shell proxy to handle cygdrive prefix if it has been changed by the user.
  • Changed reporting of registry Autorun entries to catch strange ansicon behaviour.

Composer-Setup 4.7.0

  • Stopped uninstall removing Composer\vendor\bin from the user path if there is another composer files directory in the path (ie from a subseqent Developer mode installation).
  • Improved shell proxy handling, in case of CDPATH conflicts.
  • Improved error reporting, making use of stderr now that PHP uses it better.
  • Added output from stdout and stderr to the log file for better troubleshooting.
  • Unattended SYSTEM installations no longer write data to the system user profile.

Composer Download on Windows

Composer is a dependency manager for PHP. We can download it from the official website. Composer is licensed under the MIT license.

Official Website: https://getcomposer.org/

Download

Download Composer-Setup.exe

Composer Install Windows

Save the file on the computer.

Composer Setup.exe Windows

Install

Double click on the Composer-Setup.exe

Composer Installation Options

Click on the Next buttons and complete the Install wizard.

Click the Finish button to complete the install.

Composer will create files to handle the configuration and dependency information.

  • composer.json
  • composer.lock

The lock file locks the dependencies of your project to a known state of the project.

Sample composer.json

{
 "config": {
 "platform": {
 "php": "7.4.2"
 }
 },
 "require": {
 "php-http/guzzle6-adapter": "^1.0",
 "slim/slim": "4.0",
 "slim/psr7": "^1.1",
 "nyholm/psr7": "^1.2",
 "nyholm/psr7-server": "^0.4.1",
 "guzzlehttp/psr7": "^1.6",
 "http-interop/http-factory-guzzle": "^1.0",
 "laminas/laminas-diactoros": "^2.2",
 "adodb/adodb-php": "^5.20",
 "phpmailer/phpmailer": "^6.1",
 "smarty/smarty": "^3.1",
 "psr/log": "^1.1",
 "symfony/polyfill-mbstring": "^1.15",
 "league/oauth2-client": "^2.4",
 "omines/oauth2-gitlab": "^3.2",
 "league/oauth2-github": "^2.0",
 "league/oauth2-google": "^3.0",
 "slim/http": "^1.0"
 }
}

All the dependencies source files would be downloaded into a folder called vendor at the project root folder. The sample folder for the TestLink application is shown below. (https://www.testingdocs.com/testlink-installation-on-windows/)

Vendor folder Composer

We can use the dependency by loading the autoload.php file. For example

require_once “vendor/autoload.php”

We can use the dependency by importing into the project source. For example,

use Slim\Psr7\Response;

PHP Tutorials

PHP Tutorials on this website:

PHP Tutorials

Contents

  • 1 Что такое Composer?
  • 2 Скачивание Composer — инсталлятор для Windows
  • 3 Установка Composer на Windows 10
  • 4 Первая команда в Composer. Как использовать Composer на Windows?
  • 5 Другие примеры команд для Composer
    • 5.1 Flarum
    • 5.2 Laravel
  • 6 Описание команд Composer
  • 7 Использованные ресурсы для написания статьи

Composer — это пакетный менеджер уровня приложений для языка программирования PHP, который предоставляет средства по управлению зависимостями в PHP-приложении. Вы можете описать от каких библиотек зависит ваш проект и Composer установит нужные библиотеки за вас! Причём Composer — это не менеджер пакетов в классическом понимании.

В двух словах как работает Composer:

  • У вас есть проект на PHP, который зависит от нескольких библиотек.
  • Некоторые из этих библиотек зависят от других библиотек.
  • Вы описываете в своём проекте те библиотеки, от которых непосредственно зависит ваш код.
  • Composer находит нужные версии требуемых библиотек для всего проекта, скачивает их и устанавливает в папку вашего проекта.

Скачивание Composer — инсталлятор для Windows

  1. Заходим на сайт https://getcomposer.org/
  2. Заходим в раздел Download
  3. В подразделе Windows Installer скачиваем Composer-Setup.exe

Скачивание Composer - инсталлятор для Windows

Установка Composer на Windows 10

Для работы Composer Требуется PHP (необходимо заранее установить на windows php).

Порядок инсталляции Composer на винду:

1. Запускаем дистрибутив с админскими правами:

Запускаем дистрибутив с админскими правами:

2. Выполняем поэтапно все пункты инсталлятора (почти всегда нажимать нужно Далее/Next), Только с php нужно выбрать директорию:

Установка и настройка Composer

Выбираем php.exe в директории с php (инсталляция Php производится отдельно)

Установка и настройка Composer

Обновляем php.ini (файл с настройками php):

Установка и настройка Composer

Прокси не нужен

Установка и настройка Composer

Устанавливаем Composer:

Установка и настройка Composer

Установка и настройка Composer

Установка и настройка Composer

Первая команда в Composer. Как использовать Composer на Windows?

Сразу после инсталляции php и composer, эти команды не будут запускаться в сторонних папках. Если у Вас нет доступа к переменным окружения, то запустить Composer можно следующим образом.

Для примера скачаем с помощью Composer проект для подключения к API (Гугловский PHP проект):

  1. Создаем на диске С папку C:\Composer_install. В ней будем создавать проекты. Создадим проект «New» (папку C:\Composer_install\New):
  2. Скопируем в папку C:\Composer_install\New файлы из папки C:\ProgramData\ComposerSetup\bin;
  3. Запустим команду composer для скачивания проекта google analytics:

C:\php\php.exe composer.phar require «google/apiclient:^2.0»

Если появится ошибка «Failed to download psr/http-message from dist: You must enable the openssl extension to download files», то нужно включить в php.ini параметр extension=php_openssl.dll, а в composer.json скорей всего понадобится включить строчки:

{

    «config»: {

        «disable-tls»: true,

        «secure-http»: false

    }

}

Как настроить переменную окружения PATH для php и composer:

Как настроить переменную окружения PATH для php и composer

После установки переменных обязательно перезапустите Windows. После рестарта винды команда composer будет запускаться в простом виде:

composer require «google/apiclient:^2.0»

composer require "google/apiclient:^2.0"

Другие примеры команд для Composer

Flarum

composer createproject flarum/flarum stability=beta

Результат работы composer Для скачивания проекта Flarum:

Результат работы composer Для скачивания проекта Flarum

Laravel

composer global require «laravel/installer»

composer global require "laravel/installer"

Описание команд Composer

Команда Composer Описание команды
composer require vendor/package Добавляет требуемый пакет в файл composer.json и устанавливает его в ваш проект.

Команда require изменяет composer.json, находящийся в текущей папке. Если пакету требуются зависимости, то они будут установлены или обновлены. А также будет обновлён composer.lock.

composer install Если файла composer.lock нет, резолвит зависимости исходя из composer.json и создаёт его. Далее, анализирует файл composer.lock, скачивает и устанавливает указанные в нём версии пакетов.
Опция --no-scripts полезна для обхода запуска скриптов, указанных в pre- и post- настройках.
composer update Обновляет ваши зависимости до последних версий и обновляет composer.lock.

Команда update резолвит зависимости чтобы получить самые последние версии зависящих друг от друга пакетов.

composer update --lock Иногда, вы можете получить такое предупреждение:

Warning: The lock file is not up to date with the latest changes in composer.json, you may be getting outdated dependencies, run update to update them.

Это может произойти после того, как вы вручную редактировали composer.json (добавляли или изменяли descriptionauthorsextra и т. д.). Даже если ваши изменения незначимы для Composer, он обнаруживает, что md5sum файла изменена, и предупреждает, что эти изменения не учтены в файле composer.lock.

Поэтому, чтобы подавить это предупреждение, вы можете просто запустить команду update --lock для обновления lock-файла без обновления самих пакетов.

composer dump-autoload --optimize Если вам нужно обновить загрузчик, т. к. появились новые классы, вы можете выполнить команду dump-autoload чтобы избежать установки или обновления пакетов.

Используйте ключ —optimize для преобразования PSR-0 в автозагрузку как для classmap, чтобы автозагрузчик был наиболее быстрым. Это настоятельно рекомендуется для production (вы можете получить 20% прирост), но может занять немного времени для запуска, так что это на данный момент не сделано по умолчанию.

Также вы можете использовать dumpautoload псевдоним.

composer about Краткая информация о Composer.
composer archive vendor/package Создать архив для указанного пакета. Команда также может быть использована для архивирования всего проекта без исключенных/игнорируемых файлов.
composer browse Псевдоним для home, открывает URL пакета или его домашнюю страницу в браузере.
composer clear-cache Псевдоним команды clearcache, очищает внутренний кэш пакетов Composer-а.
composer config --list Позволяет редактировать некоторые основные параметры Composer-а либо в локальном файле composer.json, либо в глобальном файле config.json.
composer create-project vendor/package dir/ Создать новый проект из указанного пакета в указанном каталоге.
composer depends vendor/package Сообщает вам какие другие пакеты зависят от конкретного (указанного) пакета. Вы можете указать какие типы связей (require, require-dev) должны быть включены в листинг. По умолчанию выводятся оба.
composer diagnose Если вы считаете, что нашли ошибку, или что-то ведет себя странно, возможно, вы захотите выполнить команду диагностики для выполнения автоматизированной проверки многих общих проблем.
composer global Команда global позволяет другие команды такие, как installrequire или update запускать так, как если бы вы запускали их из каталога COMPOSER_HOME.

Это может использоваться для того, чтобы установить командные утилиты глобально. Если вы добавите $COMPOSER_HOME/vendor/bin в переменную $PATH вашего окружения, то запуск утилит станет совсем простым.
Например, установите php-cs-fixer:
$ php composer.phar global require fabpot/php-cs-fixer:dev-master
Теперь исполняемый файл php-cs-fixer доступен глобально и вы можете запустить его из любого места (конечно, если вы настроили вашу переменную PATH).

composer help [command] Отображает справки для всех других команд: composer.phar help install.
composer init Создает базовый вариант файла composer.json в текущем каталоге.

При запуске команды, Composer будет интерактивно запрашивать значения полей для заполнения, используя при этом для некоторых полей умные значения по умолчанию.

composer licenses Показать информацию о лицензиях зависимостей.
composer list Выводит список допустимых команд.
composer remove Удаляет пакет из секций require или require-dev: remove vendor/package vendor/package2.
composer run-script Запустить вручную скрипты, объявленные в composer.json. Просто передайте название скрипта и при необходимости --no-dev, чтобы отключить режим dev.
composer search ключевые слова Поиск пакетов.

Подписывайся на мой канал «Data Engineering» в телеграме

Подписаться

Команда поиска позволяет вам искать в репозиториях текущего проекта (см. секцию «repositories» в composer.json).  Обычно это будет только packagist.org. Вам нужно просто передать команде слова для поиска.

composer self-update Обновление самого composer.phar до последней версии.

Запуск команды self-update может решить некоторые проблемы и сэкономить ваше время.

Также вы можете использовать псевдоним selfupdate.

composer show Список всех установленных пакетов (composer show).
Список всех доступных пакетов (composer show --all).
Инфо об указанном пакете или его специфичной версии (composer show vendor/package [версия]).
composer suggest Выводит список всех пакетов, предложенных установленными. Опционально вы можете передать одно или несколько имён пакетов в формате vendor/package чтобы ограничить вывод только теми, что были предложены указанными.
composer status Если вам часто приходится модифицировать код своих зависимостей, а они были установленны «из исходников» (см. опцию --prefer-source команды require), то
команда status позволит вам проверить есть ли у вас локальные изменения в любой из них.
composer validate Проверяет файл composer.json.

Вы всегда должны запускать команду validate перед тем, как коммитить ваш composer.json и перед установкой релизного тега. Эта команда проверит его на ошибки.

Использованные ресурсы для написания статьи

  1. https://phpprofi.ru/blogs/post/52

Don’t like the intro? Skip to the Tutorial here.

Introduction

A long time ago, to include an external PHP library into a PHP development project, you had to:

  • Download the PHP library (in zipped format);
  • Extract it into a directory inside the project;
  • Include it using a require_once function;

That was the process. When deploying your project, you have to upload everything including the library files. And when a package gets an update? You download it, extract, overwrite the files, all over again.

That’s why Composer is a savior for PHP developers, or in short, Composer is a PHP dependency manager.

What is Composer?

As the above introduction, Composer is a PHP dependency manager, which greatly helps the PHP development process. Its main functionalities are:

  • Install, include, update PHP dependency libraries in a project quickly;
  • Declare dependencies in a PHP package/project easily;

Whether you have a project depends on other libraries, and some of the libraries also depend on other libraries, Composer can handle this easily!

In Official Composer Introduction page, Composer can:

  1. Enables you to declare the libraries you depend on.
  2. Finds out which versions of which packages can and need to be installed, and installs them (meaning it downloads them into your project).
  3. You can update all your dependencies in one command.

Therefore, it’s a no-brainer to use Composer in your PHP development.

Composer supports both Windows, Linux and MacOS. This in-depth article will guide you on how to install Composer on Windows operating system.

Tutorial StartsInstall Composer on Windows – Step by step

As any other softwares, Composer has its own system requirements too.

1. System requirements for Composer on Windows

  • You have PHP installed -OR- you have PHP package downloaded already with executable file (php.exe).

We have an in-depth tutorial on how to download and install PHP on Windows:

How to install PHP on Windows – Standalone method

Latest Composer requires at least PHP 7.2.5 to run. If you run legacy PHP version (but still at least requires PHP 5.3.2), there are old Composer versions, but it will pose many incompatibilities issues, so we don’t recommend using legacy versions.

2. Download Composer on Windows

Composer makes it very straightforward to download and setup on your Windows system. To download the latest version, head to the official Composer Windows package download URL:

https://getcomposer.org/Composer-Setup.exe

https://getcomposer.org/Composer-Setup.exe

3. Installing Composer

Run the Composer-Setup.exe file that you just downloaded.

First, you will choose the Install Mode. It’s recommended to install for all users if you have administrator privilege. But if not, you can just install for your account, Composer can still run normally.

Select install mode

Next, if you choose Developer mode, there will be no uninstaller included. It’s up to you on this one.

PHP101.net - Tutorial - Installing Composer on Windows

Specify if Developer mode is enabled

Choosing php.exe executable path is required on the next step. This is the path where PHP is installed on your system. If there is one installed, Composer will automatically detect it, else you can manually Browse… and specify the file location.

PHP101.net - Tutorial - Installing Composer on Windows

Specify PHP installation/executable path

Specify if you are using any proxy enabled for browsing the Internet.

PHP101.net - Tutorial - Installing Composer on Windows

Proxy configuration

This Ready to Install screen will have the main configuration displayed for you to check before the installation start. Click Install when everything is good.

PHP101.net - Tutorial - Installing Composer on Windows

Installation configuration before installing

The installation will start. You will see these screens when the installation is finished:

PHP101.net - Tutorial - Installing Composer on Windows

Composer installation finished

Now the installation is done. In summary, this installation will:

  • Download the latest composer.phar file from Composer server;
  • Copy it and the configuration files, the uninstaller (if checked) into your user’s \AppData\Local\ComposerSetup\ folder (in your user mode) or C:\ProgramData\ComposerSetup\ folder (all users mode);
  • Add Composer into Windows Environment Variables so it can be run from command lines.

We will verify the installation on the next step.

4. Verify Composer installation

To check if Composer has been probably installed, open any Windows terminal tools (cmd.exe, PowerShell, VSCode terminal, etc.) and enter this command:

composer --version

Alternatively, composer -V (V in capitalized) is the same command. If this similar message returns, Composer has been successfully installed:

C:\Users\php101dotnet>composer -V
Composer version 2.0.14 2021-05-21 17:03:37

5. Update Composer on Windows

To update Composer on Windows, you can just follow the steps above to download the latest Composer and install it again, which will update Composer to the latest version.

Example Usage

This is a quick example Composer usage to show how easy it is (but also powerful).

Assuming we have an empty PHP project that needs URL slug functionality which turns text into slug URL for SEO purposes (eg. an example project to an-example-project). Instead of writing this functionality from scratch, we will use the ausi/slug-generator library written by GitHub user ausi, which is already perfect to do that.

On the (empty) PHP project folder, use the terminal and enter this command:

composer require ausi/slug-generator

This Composer command will:

  • Download the ausi/slug-generator package which is located on Packagist.org – the main Composer package repository
  • Install it into our PHP project directory under the vendor folder,
  • Add the package information at composer.json file
  • Record the version, time, hashes into composer.lock file to keep track of the packages’ states
  • Handle all library inclusion into vendor\autoload.php file

Graphical views of the package installation after running the command:

Folder layout after installing Composer package

That is very handy, compared to downloading the package manually and copying it. So to use the package, we just have to include the autoload.php file. For example on our project:

<?php

// Include all Composer vendor libraries
require_once('./vendor/autoload.php');

// Include Slug library
use Ausi\SlugGenerator\SlugGenerator;

// Start using it!
$generator = new SlugGenerator;
echo $generator->generate('php101.net Composer installation example'); 

// Output: php101-net-composer-installation-example

As you see, it is extremely convenience to use Composer for PHP projects.

Final thoughts

This marks the end of our tutorial on how to install Composer on Windows for PHP dependency management. With PHP development, knowing how to use Composer is a must.

We will constantly update this article with new information, as well as releasing other articles with more helpful Composer use cases.

Thanks for reading and hopefully this tutorial is helpful for you.

You might also like

  • PHP installation on Windows – Standalone method

References

  • Composer official website
  • Packagist.org for PHP packages

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Таблица windows 10 pro
  • Как поставить высокий приоритет на игру в windows 10 в параметрах
  • Aptio setup utility как установить windows
  • Программа для записи nfc windows
  • Установщик модулей windows что это за служба