Skip to content
Advertisement

keep composer 1 & 2 both in same machine

How we can use composer 1 & composer 2 both in the same machine.
As a developer we worked on the multiple project in the same machine and situation comes where project 1 required composer 1 and project 2 required compower version 2.

Advertisement

Answer

This is what I used to have composer 1 & 2 both in the same machine. I am hoping this will helpful for someone, who want to use composer 1 & 2 both as separate command

Keep Composer 1 & 2 as separate command

Setup Composer 1:

Step 1: copy the current composer directory to new
cp which composer /usr/local/bin/composer1

Step 2: Update it to version 1:
composer1 self-update –1

Upgrade to Composer 2 & create alias:
Step 1: update composer to version 2
composer self-upgdate –2

Step 2: create symlink for composer2 (optional)
ln -s which composer /usr/local/bin/composer2

Now you can use composer or composer2 command for the project dependent on composer 2

and composer1 command for the project have dependency on composer 1

Note: you might required to use sudo before the command

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement