Home > Back-end >  How to install two composer in one windows system?
How to install two composer in one windows system?

Time:01-29

How to install two composer in one windows system? (how to use difference composer in one windows system)

CodePudding user response:

If you're using the windows installer only, IIRC you can't as it ships with the precondition to install under the canonical composer name.

However if you download the phar file, you just need to use the phar file of the version you would like to execute. This works independently to using the windows installer - both with and without it.

This has also the benefit that you can specify the PHP executable you would like to run composer.phar with.

c:\> c:\my\php.exe c:\my\composer-2.2.10.phar --version

This is basically what the Composer manual means where-ever it writes php composer.phar ....

You replace php with the PHP executable you would like to use and composer.phar with the composer phar you would like to use.

The windows setup installer is just installing the latest with the PHP version on your system under the canonical name composer. But instead you can create your own composer.bat.

You can then also create two such files for the different versions, e.g. composer-blue.bat and composer-red.bat.

This technique should be compatible to have next to composer with the windows setup installer, so you can use it to install one version you manage with the setup and zero up to N versions you manage yourself with the phar files.

CodePudding user response:

for window do the following steps:

  • one -> (create composer1 directory in C:\composer_path)

  • two -> (copy three file in composer directory to composer1 directory)

  • three -> (set path composer1 to environment variable)

  • four -> (run composer1 self-update --1 in cmd) because Convert to version 1.0.0

  • five -> (test versions composer)

and Done! ^_^

you can see two version of composer installed in one windows system.


updating :

You are better off using version 2.2.18. this version latest version of support to php 7.2.5 and Compared to version 1, it is much better and faster!

It is enough for this go to composer website and download composer.phar version 2.2.18 and replace in composer.phar in composer1 directory.

.Thanks @hakre for this Tip

  • Related