keep composer 1 & 2 both in same machine
Asked Answered
L

2

8

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.

Lynden answered 13/12, 2020 at 6:36 Comment(2)
Welcome to SO. In this case you better ask your question first like How to keep composer 1 & 2 both in same machine? and then add your answer and accept it.Ludwigshafen
thanks for the suggestion, i will follow the same.Lynden
L
8

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:

  1. Copy the current composer directory to new

    cp `which composer` /usr/local/bin/composer1
    
  2. Update it to version 1:

    composer1 self-update --1
    

Upgrade to Composer 2 & create alias:

  1. Update composer to version 2

    composer self-update --2
    
  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

Lynden answered 14/12, 2020 at 13:12 Comment(0)
S
0

for windows 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.

reference : How to install two composer in one windows system?

Sanction answered 28/1, 2023 at 15:52 Comment(2)
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From ReviewMarmoreal
2.5.1 is not the composer LTS version, the LTS version is on the 2.2 channel. And honestly I see no need to duplicate your own answer as the comlete Q&A is here: https://mcmap.net/q/1468585/-how-to-install-two-composer-in-one-windows-system and also prominently linked as related question already. Please remove it and improve the original answer.Ewan

© 2022 - 2024 — McMap. All rights reserved.